편집 기록

편집 기록
  • 프로필 엽토군님의 편집
    날짜2019.01.23

    [파이썬] 문자열 속 특정 문자 검색하기


    infile=open("python_07_05.txt",'w')
    
    words=input()
    word=input()
    if word in words:
        infile.write("find word :"+word)
    
    infile.close()
    
    outfile=open("python_07_05.txt",'r')
    text=outfile.read()
    print(text)
    outfile.close()
    
    

    words에 데이터를 입력받고 word에 찾고 싶은 단어를 입력했을때 있으면 출력하고 없으면 아무것도 출력하지 않는 코드를 짜려고 합니다.

    1. I heard that you're good at ~ 같은 문장 같은 경우에 you를 검색하면 출력되면 안되는데 출력되는 문제
    2. 출력된 결과물이 find word : you 처럼 콜론 사이에 공백을 한칸씩 만들고 싶은데 저 코드를 출력하면 find word :you 와 같이 오른쪽 공백이 만들어지지 않습니다.

    어떻게 코딩해야 할지 조언 부탁드립니다. 감사합니다.

  • 프로필 알 수 없는 사용자님의 편집
    날짜2019.01.23

    [파이썬] 문자열 속 특정 문자 검색하기


    infile=open("python_07_05.txt",'w')
    
    words=input()
    word=input()
    if word in words:
        infile.write("find word :"+word)
    
    infile.close()
    
    outfile=open("python_07_05.txt",'r')
    text=outfile.read()
    print(text)
    outfile.close()
    
    

    words에 데이터를 입력받고 word에 찾고 싶은 단어를 입력했을때 있으면 출력하고 없으면 아무것도 출력하지 않는 코드를 짜려고 합니다. 1) I heard that you're good at ~ 같은 문장 같은 경우에 you를 검색하면 출력되면 안되는데 출력되는 문제 2) 출력된 결과물이 find word : you 처럼 콜론 사이에 공백을 한칸씩 만들고 싶은데 저 코드를 출력하면 find word :you 와 같이 오른쪽 공백이 만들어지지 않습니다. 어떻게 코딩해야 할지 조언 부탁드립니다. 감사합니다.