Python Forum
How to save a class object to a file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to save a class object to a file?
#2
Pickle or Shelve.

https://docs.python.org/3/library/pickle.html
https://docs.python.org/3/library/shelve.html

If it's just one object (the player), then Pickle. Shelve is sort of like a dictionary interface for using Pickle with a lot of different things.
Reply


Messages In This Thread
RE: How to save a class object to a file? - by nilamo - Jun-22-2019, 11:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing out incidence values for Class Object SquderDragon 3 304 Apr-01-2024, 07:52 AM
Last Post: SquderDragon
  Open/save file on Android frohr 0 339 Jan-24-2024, 06:28 PM
Last Post: frohr
  error in class: TypeError: 'str' object is not callable akbarza 2 525 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  how to save to multiple locations during save cubangt 1 564 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  save values permanently in python (perhaps not in a text file)? flash77 8 1,250 Jul-07-2023, 05:44 PM
Last Post: flash77
  Save and Close Excel File avd88 0 3,084 Feb-20-2023, 07:19 PM
Last Post: avd88
  Save multiple Parts of Bytearray to File ? lastyle 1 963 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
Sad Want to Save Print output in csv file Rasedul 5 10,994 Jan-11-2022, 07:04 PM
Last Post: snippsat
Exclamation win32com: How to pass a reference object into a COM server class Alfalfa 3 4,903 Jul-26-2021, 06:25 PM
Last Post: Alfalfa
  How to save Matplot chart to temp file? Morkus 2 4,542 Jun-12-2021, 10:52 AM
Last Post: Morkus

Forum Jump:

User Panel Messages

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