Python Write in file and read from file

Python Write in file and read from file

By SlashReal | Coding_tuts | 6 Apr 2023


file open("yourfilename.txt", "a")

file.write(  str(your_variable))

file.close()

file = open("youfilename.txt", "r")

print(file.read())

How do you rate this article?

1



Coding_tuts
Coding_tuts

Programming tutorials

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.

Page not displaying correctly?