Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write in txt
#2
Writing something in a text file is simple. You can use pickle to kind of encode the data -
import pickle

file = open('file.txt', 'wb') #'wb' means write bytes
pickle.dump(file, variable) #dump means to save it in there
file.close()

file = open('file.txt', 'rb') #"rb" means read bytes
variable = pickle.load(file)

Hopes this helps
Reply


Messages In This Thread
How to write in txt - by pari88 - Apr-20-2019, 04:57 AM
RE: How to write in txt - by SheeppOSU - Apr-20-2019, 05:04 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020