Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a6d750a

Browse filesBrowse files
committed
Merge pull request #625 from gsenesac/serialization
Added serialization.rst file to scenarios.
2 parents 231f548 + 5ce9c8a commit a6d750a
Copy full SHA for a6d750a

File tree

Expand file treeCollapse file tree

1 file changed

+40
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+40
-0
lines changed

‎docs/scenarios/serialization.rst

Copy file name to clipboard
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
==================
2+
Data Serialization
3+
==================
4+
5+
What is data serialization?
6+
---------------------------
7+
8+
Data serialization is the concept of converting structured data into a format
9+
that allows it to be shared or stored in such a way that its original
10+
structure to be recovered. In some cases, the secondary intention of data
11+
serialization is to minimize the size of the serialized data which then
12+
minimizes disk space or bandwidth requirements.
13+
14+
Pickle
15+
------
16+
17+
The native data serialization module for Python is called `Pickle
18+
<https://docs.python.org/2/library/pickle.html>`_.
19+
20+
Here's an example:
21+
22+
.. code-block:: python
23+
24+
import pickle
25+
26+
#Here's an example dict
27+
grades = { 'Alice': 89, 'Bob': 72, 'Charles': 87 }
28+
29+
#Use dumps to convert the object to a serialized string
30+
serial_grades = pickle.dumps( grades )
31+
32+
#Use loads to de-serialize an object
33+
received_grades = pickle.loads( serial_grades )
34+
35+
Protobuf
36+
--------
37+
38+
If you're looking for a serialization module that has support in multiple
39+
languages, Google's `Protobuf
40+
<https://developers.google.com/protocol-buffers>`_ library is an option.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.