开发者

Can any one please let me know that where exactly Python-Pickle used and give me one great example to understand [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Pickle Python Serialization

Hi I am new to python. Please explain where exactly we will use pick开发者_Python百科le and give me one clear example to understand...it would be great if you could do this....


You will come to know when you really want to serialize the data, store it and reuse it. Suppose in a particular python script, you decide to create a graph, usually the graph can be best stored as a dictionary of lists. Now, you can store them some form of a database or a flat file, in which case you would have to reconstruct the data structure when you read it back. Suppose, you think of having an ability to store the data-stucture and its contents in form and get back the exact data-structure and use it from the point go. There you have pickle coming in handy. This is very useful when you want to send your data(-structure) over the network for another program to consume. Check this simple example here and some documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜