You are viewing a single comment's thread from:

RE: Learn Python Series (#28) - Using Pickle and Shelve

in #utopian-io6 years ago

Hi, and thx! ;-)

I've discussed 2 modules, pickle and shelve (they're two different modules, where shelve is built on top of pickle). The key take-away of this episode is to explain that dumping via pickling is a way to "serialize" a Python object (for example a dictionary or a list), which is kept in RAM and only works "inside the program), and is then "pickled" to save in a file in a binary mode, where the pickle contains the full instructions to un-pickle, ergo, to read it back, by another or the same program at another time, after the program was closed, and to put it back in RAM.

Simple use case? When you're playing a game and you're saving your progress on level 14 before you to to sleep. Saving the "game state" == pickling ;-)

Sort:  

Ooh wow
That's elucidiated things
I fully get the application now
Its like saving a data state and all the changes with a single module. That's awesome
Thanks

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 59114.57
ETH 2309.50
USDT 1.00
SBD 2.49