Python Learning Section 13th (Sys,logging,logger,json)

Source: Internet
Author: User

SYS module
SYS module is a module of communication between Python and interpreter

SYS.ARGV can be automatically formed as a list after you enter content in cmd, you can slice it in the program, verify the role of login.

The Sys.exit () program ends immediately, no matter what program is behind it.
Sys.path displays the path of the current search module
First search the path of the directory where the current script is located to find the required modules, not to go to the python environment variable to find
You can add a search path to the list of Sys.path in the following way, and ask him to go to another path to search for the module

Log error log configuration file, blog address

Http://www.cnblogs.com/yuanchenqi/articles/6766020.html

Change the log alarm level

Relevant explanations about the logger:

Logger can be seen as a log person, for every log recorded, he needs a set of rules, such as the format of the record (formatter), level, and so on, the rule is handler. By using Logger.addhandler (handler) to add multiple rules, you can have one logger record multiple logs.
Related Blog Links:
Http://www.cnblogs.com/anpengapple/p/5048123.html

Json
Import JSON

The list of objects that are serialized.
JSON, though it looks like a dictionary, is a string.
The quotation marks in the JSON standard format are double quotes.

This process is serialized and written to the file.

Deserialization:

Serialization string

Another way to apply dump
Write the content and, F is equivalent to adding a write operation

Another way to apply load
Equivalent to read and loads

Pickle
The Pickle module has the advantage of supporting all Python data types, with the disadvantage that Python is used only, as is the case with JSON.

Datatime
Object type

Python Learning Section 13th (Sys,logging,logger,json)

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.