Day6 Python learns essays.

Source: Internet
Author: User

    1. Serialization of

Tools have json,pickle.

Used to convert complex data types into strings.

#json必须是 the Key,value data type.

#pickle仅限python使用支持python大部分数据类型.


2. Log module




3. Execute the Command module

The relevant modules and functions that can execute shell commands are:

    • Os.system

    • os.spawn*

    • os.popen*--Waste

    • popen2.*--Waste

    • commands.*-Discarded, removed in 3.x

The functions of the relevant modules and functions for executing shell commands are implemented in the Subprocess module and provide richer functionality.

Cases:

Pager

ret  = subprocess.call([ "ls" "-l" ], shell = False ) #shell为False时使用python的接口执行命令,传递命令参数只能通过列表。

ret = subprocess.call("ls -l", shell=True) #shell为True时使用默认shell执行,传递命令参数采用字符串拼接的方式,列表和引号皆可使用。





3. Regular

Re





4. Time Module


This article is from the "Li-Enlightened" blog, please make sure to keep this source http://jzzjw.blog.51cto.com/9921462/1718382

Day6 Python learns essays.

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.