| | |
Saving pickled info and reloading info
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi count_chockula,
You can indeed edit a dictionary. You would load the dictionary with pickle.load(), then add a new key-value pair, then dump it again, like so: Now filename.txt contains the same pickled dictionary from before, but with an addition.
You can indeed edit a dictionary. You would load the dictionary with pickle.load(), then add a new key-value pair, then dump it again, like so:
python Syntax (Toggle Plain Text)
f = open("filename.txt", "r") d = pickle.load(f) f.close() d["new_key"] = "new_value" f = open("filename.txt", "w") pickle.dump(d, f) f.close()
Vi veri veniversum vivus vici
![]() |
Similar Threads
- Domain name: debugger.biz, insures.info, parkings.info... (Domain Names for Sale)
- 5 future Tech. .info Domains to invest in, dark-web.info, hdstation.info, etc.. (Domain Names for Sale)
- ShopShot.com, DrugFinder.info, USAimmigration.info, eGenre.com, plus 15 more! (Domain Names for Sale)
- allwww.info (Relevant Link Exchanges)
- c program to extract system info (C)
- Blue page w/errors (Troubleshooting Dead Machines)
- Client and Site Info Management (IT Professionals' Lounge)
- 14 .infos + 1 .com for just $10! Including fashionweeks.info , eBizTrainingManual.com (Post your Resume)
Other Threads in the Python Forum
- Previous Thread: new Python user has Export Problems
- Next Thread: Creating Install Module
| Thread Tools | Search this Thread |
accessdenied apache application argv array beginner book builtin change chmod converter countpasswordentry curved dan08 dictionary dynamic edit enter examples file filename float format function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl pysimplewizard python random recursion redirect remote reverse scrolledtext session simple smtp software sprite statictext string strings syntax table tennis terminal text textarea thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython





