Ask coding questions

← Back to all posts
python open and read file with repl.it
AbdelghaniTahar (2)

how to open and read file with repl.it on line

Comments
hotnewtop
HappyFakeboulde (241)

Add a file in the editor
Give it a name
In your program put f = open(filename, "r") where filename is the name of the file you created
To read from the file put t = f.read() where t is the name of the variable to save it in
Remember to close the file object with f.close()