Can any one please let me know that where exactly Python-Pickle used and give me one great example to understand [duplicate]
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.
精彩评论