0

So far I have got this:

file=open(" The portal","w")
file.write(input("text to be written in the  file: "))
file.close()

However I am required to have an exit option (on python), to close the file. I've tried exit(), but that closes python not the file. Any ideas?

khelwood
  • 55,782
  • 14
  • 81
  • 108
K.Bun
  • 1
  • 1

0 Answers0