Ben Monastyrsky Ben Monastyrsky - 3 months ago 10
Python Question

Python write() function not working

f = open('path.txt','w')
text = f.write('This is a test\n')
print(text)


This is supposed to write on the file path.txt "This is a test" but it doesn't.

Answer

Try doing

f.close()

and delete

print(text)

Hope I helped. :)