API
API
Annotation
Json.dumps ()
Converts a dictionary in Python to a string
Json.loads ()
Convert a string to a dictionary
Json.dump (,)
Write data to the JSON file
First, the introduction of the meta-groupPython's tuples and lists are similar, except that the elements of a tuple cannot be modified, tuples use parentheses, and the list uses square brackets.Access tuples: tuples subscriptThe tuple's built-in
Program entryFor many programming languages, the program must have a portal, such as c,c++, and a fully object-oriented programming language java,c#. If you have been exposed to these languages, the concept of program entry should be well understood,
1. Comment on several annotation methods in Python:(1) #号注释 single-line comment# This is a commentdef func ():Pass(2) Multi-line Comment""" """ ‘‘‘ ‘‘‘Multi-line comments are also divided into single quotes, multiline comments, and double quotation
1. Variable definitionThe type of the Python variable does not need to be defined, only the name of the variable is defined, i.e. A = 10Variable gets the value of the type, then the data type of the variable is the type2. Input of dataPython input ()
The following error occurred while running the Python program:Import requests Modulenotfounderror:no module named ' requests 'Cause: The requests library was not importedWorkaround:Start Menu Select Run, enter cmd to run, and then the CD command
In writing code will encounter some parameters related to small problems, recorded, convenient self-examinationSometimes when defining a function, the parameters are optional and the number of arguments can be**kwargs Dictionary Object*args Array
Decorative DeviceDefinition: A tool that has a function that refers to adding new functionality to the adorner object, so the adorner is the tool that adds new functionality to the adorned objectNote: The adorner itself can be any callable object,
1. Determine the number of encoded bytes used by the Python interpreter to represent Unicode single characters1 Import SYS 2 Print (Sys.maxunicode)The print result is 65535, which indicates the use of the UCS2 standard, 2 bytesIs 1114111, which
A concise explanation of the use of sys.argv[] in PythonBecause it is reading self-taught python, began soon after the introduction of the module function, and has been on the idle edit after the run, trying to find its use from the results, but the
Module1 What is a moduleA module is a collection of functions.There are three sources of modules1. Built-in Modules2. Third-party modules3. Custom ModulesFormat of the module:1. py files written using Python2 C or C + + extensions that have been
1. Tuples(1, 2, ' A ', ' abc ')Tuples are read-only data types that, once created, cannot be modified and can only be queriedQuery by index, slice query, slice + step query and string query are similar1 ' a ' ' ABC ' )2print(t[0]) 3print(t[0:2]
1. The assignment operation is the same data with the same memory address2.copy is a shallow copy, can only copy the first layer of data nested data, nested data and assignment operation, the same as its memory address, when one is changed, the
Once the program has an error, it stops at the wrong place and does not continue to execute the followingUse try and except to handle exceptions1 Try : 2 code block detected 3except exception type:4 try to execute the logic of this
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