JSON, Pickle

Source: Internet
Author: User

What does serialization mean?

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

Turns memory data into characters, called serialization

Convert character to memory data type, called deserialization

Import Json,pickle

JSON, used to convert between string and Python data types

data = {' name ': ' Rong '}

D = json.dumps (data) #直接将数据转成字符串

D2 = Json.loads (d) #直接将字符串转成数据类型

Json.dump (): Write to Hard disk

data = {' name ': ' Rong '}

f = open (' Test.json ')

Json.dump (data, F)

F.close ()

Json.load (): Read back from the file

Pickle, used for Python-specific types and Python data types for conversion

Import shelve

JSON, Pickle

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.