Python Second week study notes (1)

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 ()

Python,os.path Simple usage

#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),

Python Basics---List---knowledge points review

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

python--Regular Expressions

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

Python Regular Expressions

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

Python Process Control statements

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.

Some of the special syntax in Python

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

Python Full stack learning--day8

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

Python data type

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

Python----Object-oriented---custom meta-class control instantiation behavior of classes

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

dependencies for offline installation of Python projects under Linux

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

Python's Re module

#正则表达式是用来干嘛的?#匹配 string# s= "Hello World"# Print (S.find ("Llo"))# Print (S.replace ("ll", "MM"))# Print (S.split ("w"))#string提供的方法是完全匹配#引入正则表达式, fuzzy matchingImport re# Ret=re.findall ("W\w{2}l", "Hello World")# Print (ret)# Red=re.findall

Python Foundation Day2

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

First, Bo Master Python basic Summary---to perfect version---Follow-up has been released

Basic data types for Python:1. Variable: List dictionary2, immutable: integer string ancestorString: "or" "# String abbreviated to STRList: [] #listGanso: () #tupleDictionary: {} #dictIntegral type: Digital #intCollection: #setsBoolean type: Correct

Python Learning Note 2-string manipulation

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

Python dictionary (Dictionary) items () method

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 Learning Note Two _ 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

Understanding the meta-class of Python

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

Python Small note 1

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

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

Total Pages: 4013 1 .... 1698 1699 1700 1701 1702 .... 4013 Go to: GO

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.