Python base-json and pickle modules

Source: Internet
Author: User

Serialization refers to converting the data type in memory into a string so that it can be stored on the hard disk or transmitted over the network to the remote, because the hard disk or the network can only accept bytes

Converting a string into an in-memory data type is called deserialization.

JSON and Pickle

Second, just convert the data type into a string into memory meaning

Json.dumps json.loads

1. Share your memory data across the network to remote others

2. Define the interaction rules for different languages

A. Plain text, disadvantage, cannot share complex data types

B.xml, bad, occupy a large space

C.json, simple, good readability

Three, the difference between JSON and pickle:

JSON supports data types with the str int tuple dict typically used when sharing data between different languages

Pickle

Support for all data types in Python can only be used in Python

Four, JSON and pickle can dump multiple times to a file, but load will error, usually a dump, a load

Python base-json and pickle modules

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.