Método flush() de Arquivo Python

Exemplo

Você pode limpar o buffer ao escrever no arquivo:

f = open("myfile.txt", "a")
f.write("Now the file has one more line!")
f.flush()
f.write("...and another one!")

Exemplo de Execução

Definição e Uso

O método flush() limpa o buffer interno.

Sintaxe

file.fileno()

Valor do Parâmetro

Sem parâmetros.