Depth copy
= = Compares the contents of the data, if it is true that the content is the same, the reference is different= After the operation is executed, the reference address of the front and back two elements is the sameShallow copy copy ()
#first import the OS packageImportOS#引入time模块是因为需要将浮点型的时间转为东八区时间Import Time#basename (path), remove the path name and return the file name separatelyf = os.path.basename ('E:/python/day-2/test.txt')#the output is Test.txtPrint(f)#dirname (path),
List : A collection of data, which can be placed in any data type, can be used for the operation of additional deletions and checksThere is a sequence table function (index is the indexed value of the list):① Create: Use [] to add elements, such as
One: Use of the RE moduleIn Python, when you need to match a string with a regular expression, you can use a module reRe module use process:Import re #导入re模块result = Re.match (regular expression, string to match) #使用match () method to match, or none
A: IntroductionRegular expressions are powerful tools for working with strings, with unique syntax and a separate processing engine.When we match a string in a large text, there are cases where the function (such as find, in) that comes with STR can
Note: In Python, non-0 values indicate that True;none and 0 represent False.If statementIf...else statementsIf...elif...else statementsNested IF statementsYou can add an if ... else statement to another if ... else statement, which is called nested.
1. Higher-order functionsPython supports functional programming, which incorporates special functions that have such functional programming features that make the code more concise.filter, reduce, mapA function similar to the one above can be used
One, the basic process of file operation.The computer system is divided into three parts: the hardware, the operating system and the application.Applications that we write in Python or other languages need to be saved on the hard drive if we want to
One, Python data typeinteger intStringLists List1, the list can be modified2. The list contains multiple strings3. The list can be indexed, sliced, indexed starting from 0, 1 for right-to-leftadd element functions to the list:Append (value) adds an
First, the Knowledge reserve1. __call__ method1 classFoo:2 def __call__(Self, *args, * *Kwargs):3 Print(self)4 Print(args)5 Print(Kwargs)6 7obj =Foo ()8 obj ()9 Ten The result is: One A__main__. Foo Object at 0x000002afe2
The first step is to create a new folder to export the required dependencies of the Python project to the Requirements.txt in Site-packages1 $ pip3 Freeze > Requirements.txtThe second step is to download all the dependent packages required for the
Native Knowledge pointsOne or two binary
Binary binary is a kind of system widely used in computing. Binary data is a number represented by 0 and 12 digits. Its base is 2, the rounding rule is "every two in one", the borrow rule is
One, string slices# slices can also fit into the string tittle=' today's hair apple ' for in Enumerate (tittle): # enumerate can loop subscript and value at the same time Print ('%s:%s' % (i,t))Second, non-empty is true# non-empty is true Print
Welcome to follow Me blog: Cloud DreamerDescriptionThe Python Dictionary items () method returns a traversal (key, value) array of tuples in a list form (not a direct list, to return a list value and also call the list
Python does not need to declare type information because the Python variable identifier does not have a type.When a list is created in Python, the interpreter creates an array-like data structure class in memory to store the information, and the
Read a document, learn from it! Write down your understanding of the Python meta-class, and welcome the great God to give you advice.My understanding is thatThe type is used to create a meta-class, which is used to create the class used to create an
How to read and write files:R opens the file in read-only mode. The pointer to the file will be placed at the beginning of the file. This is the default mode.r+ open a file for read-write. The file pointer will be placed at the beginning of the file.
Usage of the where () function in Python, pythonwhere
Where () Usage
The where () function returns different results for different inputs.
1 When the array is a one-dimensional array, the returned value is a one-dimensional Index, so there is only
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