S1 = s.copy () s1[0]= ' s1 ' s[2][0] = 2s1[2][1]=4 output: [' s ', ' sname ', [2, 4]][' s1 ', ' sname ', [2, 4]]A shallow copy only copies the first layer, or S1 copy, to generate a new space storage s sname modification will not affect s in S1
IfConditional judgment is to execute a program fragment when a condition is true, otherwise execute another.3if age >= 18: print(‘your age is‘, age) print(‘adult‘)else: print(‘your age is‘, age) print(‘teenager‘)So the basic format of the IF
List: [1,[2, ' three '],4] dictionary {' Food ': ' spam ', ' taste ': ' Yum '} tuple (1, ' spam ', 4, ' U ')File Myfile=open (' Eggs ', ' r ')Python includes a number of math modules that are used to load the appropriate toolkit, such as import math,
ArgparseDescription
Handling optional and Positional parameters
Handles both optional and positional arguments
Produce standardized Help information
Produces highly informative usage messages
Parser supporting scheduling sub-
#define a generator that is the same as a function, except that the yield keyword, which is actually similar to returndefEasyyield ():yield1yield2#instantiate the generator with an object, bind to the variable, and get the content of yield by nextA =
https://ke.qq.com/course/263945#tuin=107a3c8ahttps://testerhome.com/topics/11327Python version: 2.7.*Section I.Python development is fast, because there are many open source modules, we stand on the shoulders of giants, so in the implementation of a
The compiler compiles each statement of the source program into a machine language and saves it as a binary file so that the computer can run the program directly in machine language at a very fast speed.And the interpreter is only in the execution
Example: status bar, menu bar, and toolbarImportSYS fromPyQt4ImportQtguiclassExample (Qtgui.qmainwindow):def __init__(self): Super (Example, self).__init__() Self.initui ()defInitui (self): TextEdit=Qtgui.qtextedit () self.setcentralwidget (textEdit)
Mind Map of this article:Program
OrderFollow the orderFor example: Wash your hands first, eat again, and then wash the dishes.
BranchAccording to different circumstances, the condition satisfies the execution of the statement under
198 House RobberYou is a professional robber planning to rob houses along a street. Each house have a certain amount of money stashed, the only constraint stopping all from robbing each of the them are that Adjac ENT houses have security system
__str__: Used to print the return value of the __str__ directly at print (object)1 classAnimal:2 def __init__(self, name):3Self.name =name4 def __str__(self):5 returnSelf.name6 7D = Animal ("Dog")8 Print(d)__fun_name: Private method1
Python and python
Python script language(The name of python originated from a script screenplay, which repeats the dialog box word by word every time it is run. Written by the famous "Uncle turtle" Guido van Rossum during the Christmas Day of 1989 .)
008 amazing branch and loop 2,008 Branch
Assert
0. Guess what functions (x
If x
(Refer to the logical operation of numbers on both sides: A and B. If A is true, B is returned. Otherwise, A is returned.
A or B. If A is true, B is returned.
Chapter 6 of python3, python3
A Python Condition Statement is a code block that is determined by the execution result (True or False) of one or more statements.
The execution process of conditional statements, such:
A condition statement, also
Python _ builtins _ credits class (15) ,__ builtins_credits
15. 'credit', credit
Class _ Printer (builtins. object) | interactive prompt objects for printing the license text, a list of | contributors and the copyright notice. | Methods defined
Python: business card management system,
After learning strings and lists,
I tried to write a very simple business card management system,
Xinmeng tries,
Don't spray,
I was too lazy to modify the business card function,
Because I don't know how to
Python _ builtins _ help class (32), python _ builtins _
32. 'help'. The received object is used as a parameter. All attributes and methods of the object are returned in more detail.
Class _ Helper (builtins. object) | Define the builtin 'help '. |
Python crawlers fool the browser by replacing the http request header to implement login, pythonheader
Take Douban as an example, access the https://www.douban.com/contacts/list to view their attention, You need to log on to view.
If you use the
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