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