파일은 언제 닫습니까?파이썬 열기 및 메모리 누수
# Read all data from input file
mergeData = open("myinput.txt","r")
allData = mergeData.read()
mergeData.close()
이 코드를 대체 할 수 있습니까?
allData = read.open("myinput.txt","r")
언제 파일을 닫을 지 궁금한가요? 명령문이 실행되면 닫힐까요? 또는 프로그램이 종료 될 때까지 대기하십시오.
나는'allData = open ('myinput.txt')을 의미한다고 생각합니다. – Iguananaut
감사합니다. 나는 추측 (초심자) 파이썬 프로그래머이다. – historystamp