Python 파일 flush() 메서드
예제
파일에 쓰는 동안 버퍼를 비울 수 있습니다:
f = open("myfile.txt", "a") f.write("Now the file has one more line!") f.flush() f.write("...and another one!")
정의 및 사용법
flush() 메서드는 내부 버퍼를 비우습니다.
문법
file.fileno()
파라미터 값
파라미터 없음。
파일에 쓰는 동안 버퍼를 비울 수 있습니다:
f = open("myfile.txt", "a") f.write("Now the file has one more line!") f.flush() f.write("...and another one!")
flush() 메서드는 내부 버퍼를 비우습니다.
file.fileno()
파라미터 없음。