2 Answers
+ 1
file = open("/usercode/files/books.txt", "r")
rl = file.readlines()
for r in rl: print(r)
file.close()
https://www.sololearn.com/compiler-playground/co6jEhLuMsB5
0
I got this answer in same forum check if this is working.
You can create empty file :
f = open("myfile.txt", "x")
And also Create a new file if it does not exist:
f = open("myfile.txt", "w")