파이썬 라인에 텍스트 파일을 읽어나는 다음과 같은 텍스트 파일을 만든 현명한
내가 라인 현명한 텍스트 파일을 읽는 일을해야 무엇fo = open("foo.txt", "wb")
fo.write("begin \n")
fo.write("end \n")
fo.write("if \n")
fo.write("then \n")
fo.write("else \n")
fo.write("identifier \n")
input = raw_input("Enter the expression : ")
print input
fo = open("foo.txt" , "rt")
str = fo.read(10)
print "Read string is : ", str
fo.close()
? 나는 fo.read()와 fo.readlines()를 시도했지만 예상 출력을 얻지 못했습니다 !!!
출력 내용은 무엇입니까? – Elric
튜토리얼의이 섹션을 파이썬 문서 - [파일 읽기 및 쓰기] (https://docs.python.org/2.7/tutorial/inputoutput.html#reading-and-writing-files) – wwii
에서 살펴보십시오. linecache.getline ('Filename.txt', Line_number)을 사용하여 무엇을 찾고 있었는지 –