Python Forum
save values permanently in python (perhaps not in a text file)?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
save values permanently in python (perhaps not in a text file)?
#5
Saving data using shelve, pickle, or json all pretty much work the same way. When you start your program you will read your archived data from a file (in shelve and pickle it will be binary, in json it will be text). When you change something that needs to be persisted, you write the file. Any way you do it you end up with a file that you need to load and update.

I prefer json over pickle or shelve. The file is human readable, and it is really fast. Pickle and shelve allow writing a wider range of types, but I don't often that to be much benefit. Most of the things you save willb e strings, ints or floats, and jsot works fine with thos.

You should post your code and describe what you are trying to save.
Reply


Messages In This Thread
RE: save values permanently in python (perhaps not in a text file)? - by deanhystad - Jul-05-2023, 02:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open/save file on Android frohr 0 465 Jan-24-2024, 06:28 PM
Last Post: frohr
  how to save to multiple locations during save cubangt 1 677 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  Replace a text/word in docx file using Python Devan 4 4,634 Oct-17-2023, 06:03 PM
Last Post: Devan
  Save and Close Excel File avd88 0 3,537 Feb-20-2023, 07:19 PM
Last Post: avd88
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,287 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  Save multiple Parts of Bytearray to File ? lastyle 1 1,052 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,904 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  Overwrite values in XML file with values from another XML file Paqqno 5 3,643 Apr-01-2022, 11:33 PM
Last Post: Larz60+
  How to split file by same values from column from imported CSV file? Paqqno 5 3,047 Mar-24-2022, 05:25 PM
Last Post: Paqqno
  Converted Pipe Delimited text file to CSV file atomxkai 4 7,433 Feb-11-2022, 12:38 AM
Last Post: atomxkai

Forum Jump:

User Panel Messages

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