python Core programming Directory

Chapter1: Welcome to python The world !- Page number :7

1.1 What is? python

1.2 origin   : Rosam 1989 Create python

1.3 characteristic

1.3.1 senior

1.3.2 object-oriented

1.3.3 Upgradeable

1.3.4 Scalable

1.3.5 Portability :python Use C Written .

1.3.6 studies of the Book of Changes

1.3.7 Easy to read

1.3.8 Easy maintenance

1.3.9 Robustness,

1.3.10 Efficient rapid prototyping tools

1.3.11 Memory manager : Memory management by python The interpreter is responsible for , Development is only about developing the planned application .

1.3.12 Explanatory and ( byte ) Compilability : No need to compile , When executed py file , Will generate .pyc or .pyo file

1.4 Download and install python

1.5 function python

1.5.1 Interactive interpreter for the command line

1.5.2 Start the script from the command line

1.5.3 Integrated development environment

1.5.4 Other integrated development environments and execution environments

1.6python file

1.7 Compare python(python Comparison with other languages )

Chapter2:Python start - Page number :31

notes : The difference between a statement and an expression

Statements use keywords to form commands , Tell the interpreter what to do .

Expressions don't have keywords , You can make the arithmetic expression , It can also be a function called with parentheses .

2.1 Program output ,print Statement and “Hello World” :print Is the key word

Print ‘%s is number %d!’%(‘python’,1) #print And string format operators (%) Use a combination of .

2.2 Program input and raw_input() Built-in functions   :raw_input() It's a built-in function

2.3 notes #

2.4 Operator : Arithmetic operator + - * / // % ** Comparison operator , Logical operators

2.5 Variables and assignments

2.6 Numbers :int,long,bool,float,complex( The plural )

2.7 character string

2.8 list [] And a tuple ()

2.9 Dictionaries {}

2.10 Code block and indent alignment

2.11 if sentence

2.12 while loop

2.13 for Circulation and range() Built-in functions :  enumerate() Built in functions loop indexes and elements

2.14 List of analytical : You can use for The loop puts all the values in a list .

2.15 Files and built-in functions open(),file()

2.16 Errors and exceptions

2.17 function :python Functions in use parentheses () call .

2.18 class

2.19 modular : File name , barring .py

2.20 Practical functions :dir,help,len,open,raw_input,str,type

Chapter3:Python Basics - Page number :59

3.1 Sentences and grammar

3.1.1 notes (#)

3.1.2 continue (\)

3.1.3 Multiple statements make up a code group (:)

3.1.4 Code groups are separated by different indentations

3.1.5 Write multiple sentences in the same line (;)

3.1.6 modular

3.2 Variable assignment := Chained assignment , Multiple assignments

3.3 identifier

3.3.1 legal python identifier : Case sensitive

3.3.2 keyword :import keyword; print keyword.kwlist Keyword plus object = sentence Use it directly

3.3.3 The built-in :dir(__builtins__) Use it directly

3.3.4 Private underline identifier _xxx: Private __xxx__: System defined name __xxx: The name of a private variable in a class

3.4 Basic style guide

3.4.1 Module structure and layout

If the module is imported ,__name__ The value of is the module name

If the module is executed directly ,__name__ The value of is __main__

3.4.2 Write the test code in the main program

3.5 memory management

3.5.1 Variable definitions

3.5.2 Dynamic type

3.5.3 Memory allocation

3.5.4 Reference count

3.5.5 garbage collection

3.6 first Python Program

3.7 Related modules and development tools

Chapter4Python object - Page number :86

4.1python object : There are three characteristics : identity id(), type type(), value

4.1.1 Object properties : use . Tag method to access properties , The most common properties are functions and methods

4.2 Standard type

4.3 Other built-in types

4.3.1 Type object and type Type object

4.3.2None,Python Of Null object : The Boolean value is False Object enumeration of .

4.4 Internal type

4.4.1 Code object

4.4.2 Frame object

4.4.3 Track the object of record

4.4.4 Sliced object

4.4.5 Omit objects

4.4.6XRange object

4.5 Standard type operators

4.5.1 Comparison of object values :< <= > >= != ==

4.5.2 Comparison of object identities :is perhaps id(a)==id(b

4.5.3 Boolean type operators :not,and,or

4.6 Standard type built-in functions

4.6.1 type()

4.6.2 cmp()

4.6.3 str() and repr()( And anti quotation operators ``)

4.6.4type() and isinstance():isinstance(a,type(a)) by True

4.6.5Python Summary of type operators and built-in functions

4.7 Type factory function :int,str,list,tyoe

4.8 Classification of standard types

4.8.1 The storage model

Type of atom : Numbers , character string

Capacity type list , Tuples , Dictionaries

4.8.2 Update the model

Immutable type : Numbers , character string , Tuples : It seems to be updated , It's actually a newly generated object , It can be used id see .

variable : list , Dictionaries

4.8.3 Access model

Direct access : Numbers

Sequential access : character string , list , Tuples

Map access : Dictionaries

4.9 Unsupported type

Chapter5 Numbers - Page number :116

5.1 Numeric type

5.2 integer

5.2.1 Boolean type :True False

5.2.2 Standard integer type :int: The length is related to the number of digits in the computer , Yes 32 position -2**31 To 2**31-1, Also have 64 position

5.2.3 Long integer : There is no upper limit

5.2.3 Unity of integer and long integer

5.3 Double precision floating point :8 Bytes

5.4 The plural

5.4.1 Built in properties of complex numbers

5.5 Operator

5.5.1 Mixed mode operators , Priority complex , Floating point numbers , Long integer , integer

5.5.2 Standard type operators

5.5.3 Arithmetic operator / Floor removal : Take away the decimal part , Returns an integer part not larger than the result ( Pay attention to negative numbers )

If you have any :from __future__ import division:/ Represents the division of floating point numbers ,// Represents the floor except ( to be divisible by ){ Divide floating-point numbers by , It's also divisible , The final result is added .0}

If there is no :from __future__ import division: When a number has a floating point number ,/ Represents the division of floating point numbers , When numbers are integers ,/ Represents the floor except ,// Always for the floor , If there are floating point numbers , Result plus .0

5.5.4* An operator ( Integer only )

5.6 Built in functions and factory functions

5.6.1 Standard type functions :cmp(),str(),type()

5.6.2 Number type function :int(),long(),float(),complex(),bool()

Function function

abs(): Returns the absolute value of the parameter

coece(): Data type conversion function , Returns a tuple containing two numeric elements after type conversion

divmod(): Built in functions combine the results of divisor and remainder operations , Returns a tuple containing quotient and remainder .

>>> divmod(5,3)

(1, 2)

>>> divmod(-5,3)

(-2, 1)

round(): Used for rounding floating-point numbers

>>> round(4.4)

4.0

>>> round(4.5)

5.0

>>> round(-4.4)

-4.0

>>> round(-4.5)

-5.0

pow(): Do an exponential operation

5.6.3 User integer only functions

5.7 Other number types

5.7.1 Boolean “ Count ”

5.7.2 Decimal floating point number

5.8 Related modules :decimal,array,math/cmath,operator,random

Chapter6 Sequence , character string , Lists & Tuples - Page number :151

notes If it's a standard built-in function (dir(__builtins__) It can be found ), So the form of execution Built-in functions Sequence object ), If it is a built-in function of a sequence (dir(str) or dir(list) or dir(tuple) or dir(dict) or dir(file) We can find out later ), So the form of execution Sequence object . Built-in functions .

6.1 Sequence

6.1.1 Standard type operators

6.1.2 Sequence type operators : in and not in,+,*, section

6.1.3 Built-in functions (BIFs):list,str,tuple,enumerate,len,reversed,zip

6.2 character string : Both single and double quotation marks are OK , Escape characters work in quotation marks

6.3 Strings and operators

6.3.1 Standard type operators

6.3.2 Sequence operators : section , Member operators in,not in

6.4 String only operators

6.4.1 Formatting operators (%)

6.4.2 String template : Simpler alternatives

6.4.3 Primitive string operator (r/R)

6.4.4 Unicode String Operators (u/U)

6.5 Built-in functions

6.5.1 Standard type functions :cmp(),sorted(): Sort total return list

6.5.2 Sequence type functions :len(),enumerate(),zip()

6.5.3 String type function :raw_input(),str(),Unicode()

6.6 String built-in functions : join( list ), split( Separator ), quote String object . Built-in functions : dir(str)

>>> L=['a','b','c']

>>> s='_'.join(L) #join Is to combine lists into strings

>>> print s

a_b_c

>>> r=s.split('_') #split Is to separate strings into lists

>>> print r

['a', 'b', 'c']

6.7 The unique characteristics of string

6.7.1 Special strings and control characters

6.7.2 Three quotes : What you see is what you get

6.7.3 String invariance

6.8 Unicode

6.8.1 The term

6.8.2 What is? Unicode?

6.8.4Codecs What is it? ?

6.8.5 Encoding and decoding

6.8.6 hold Unicode It is applied to practical application

6.8.7 Lessons from reality

6.8.8 Python Of Unicode Support

6.9 Related modules :string,re

6.10 Summary of string key points

6.11 list []

6.12 The operator

6.12.1 Standard type operators : Comparison operator , Compare the elements of the two lists separately , Until one side wins .

6.12.2 Sequence type operators : section , Membership operations (in,not in), Join operators +,append(),*

6.12.3 List type operator and list parsing : Use square brackets and for loop

6.13 Built-in functions

6.13.1 Standard type functions :cmp(): Comparison operator

6.13.2 Sequence type functions :

len(),max(),min(),sorted(),reversed(),enumerate(),zip(),sum(),list(),tuple()

6.13.3 List type built-in function :range()

range(1,4):1,2,3

range(4,1,-1):4,3,2

range(-4,-1):-4,-3,-2

range(-1,-4,-1):-1,-2,-3

6.14 Built in functions for list types : List objects . Built-in functions :

dir(list):append(),insert(),pop(),remove()

notes : Strings are immutable : Methods of immutable objects cannot change their values , So they have to return a new object . And the list is variable , Methods of using mutable objects , These operations are performed in place , That is to say, the contents of the existing list will change , But there is no return value , Don't be silly a=a.append()!

6.15 Special features of lists

6.15.1 Building other data structures with lists : Stack : Last in, first out . queue : New in new out .

6.16 Tuples ()

6.17 Tuple operators and built-in functions

6.17.1 Standard type operators , Sequence type operators and built-in functions : Consistent with list .

6.17.2 Tuple type operators and built-in functions , Built in method : no .

6.18 Special characteristics of tuples

6.18.1 What effect does immutability have on tuples ?

6.18.2 Tuples are not that good “ immutable ”:+ Update to new object . You can change a value of a list element of a tuple .

6.18.3 Default collection type

6.18.4 Single element tuples :(‘xyz’,)

6.18.5 Dictionary key words

6.19 Related modules :copy,re,operator

6.20 Copy Python Object shallow copy and deep copy

6.21 Summary of sequence types

Chapter7 Mapping and collection types - Page number :250

7.1 Mapping type : Dictionaries {} You can view the properties of the dictionary type dir(dict)

7.2 Mapping type operators : Splicing is not supported + And repeat * The operation of

7.2.1 Standard type operators

7.2.2 Mapping type operators [],in,not in

7.3 Built in and factory functions for mapping types

7.3.1 Standard type functions [type(),str() and cmp()]

7.3.2 Mapping type related functions :dict(),len(),hash()

7.4 Built in function of mapping type dir(dict):keys(),values(),items(),get(),copy()

7.5 Key to dictionary

7.5.1 A key is not allowed to correspond to multiple values

7.5.2 The key must be hashable : Immutable types are hashable .

7.6 Collection types ([])

7.7 Set type operators

7.7.1 Standard type operators ( All set types )

7.7.2 Set type operators ( All set types )

7.7.3 Set type operators ( Only for mutable sets )

7.8 Built-in functions

7.8.1 Standard type functions :len()

7.8.2 Set type factory function :set(),frozenset()

7.9 Set type built in method

7.9.1 Method ( All collection methods )

7.9.2 Method ( Only for mutable sets )

7.9.3 Operators vs. built-in methods

7.10 The operator , function / Method

7.11 Related modules :set

Chapter8 Conditions and Cycles - Page number :285

8.1 if sentence

8.1.1 Multiple conditional expressions :and,or,not

8.1.2 Block of code for a single statement

8.2 else sentence

8.2.1 avoid “ Hang else”

8.3 elif sentence

8.4 Conditional expression ( namely “ ternary operator ”)

X if C else Y   #C Is a conditional expression ;X yes C by True The result of time ;Y yes C by False The result of time

8.5while sentence

8.5.1 General grammar

8.5.2 Count cycle

8.5.3 Infinite loop

8.6 for sentence : Can be used in list parsing and generator expressions .

8.6.1 General grammar : Sequence or iterator

8.6.2 For sequence type : character string , list , Tuples

Iterate through sequence items for x in object   print x

Iterate through the sequence index for x in range(len( object )) print object [x]

Iterate through items and indexes for x,y in enumerate( object )  print x,y

8.6.3 For iterator type

8.6.4 range() Built-in functions :range() The complete grammar of

8.6.5 xrange() Built-in functions

8.6.6 Built in functions related to sequences

sorted() and zip() Return a sequence ( list )

reversed() and enumerate() Return iterator ( Similar sequence )

8.7 break sentence : Ends the current loop and jumps to the next statement

8.8 continue sentence : Terminate the current loop , And ignore the remaining statements , And then back to the top of the loop , Go to the next iteration .

stay while and for In circulation ,while Circulation is conditional , and for The loop is iterative .

8.9 pass sentence : Not doing anything . When developing and debugging , We can fix the structure first .

Pass It can be used in any required statement block ( Such as if,for,while,elif,else,class,def,try,except,finally)

8.10 We can talk else sentence

if else,while else,for else: As long as the cycle ends normally ( Not through break),else Clause will be executed .

8.11 Iterators and iter() function

8.11.1 What is iterator ?

8.11.2 Why iterators ?

8.11.3 How to iterate ? next(),reversed(),enumerate(),any(),all()

8.11.4 Using Iterators : Sequence (iter) And the dictionary (iterkeys,itervalues,iteritems), file

8.11.5 Mutable objects and iterators

8.11.6 How to create iterators :iter( object )

8.12 List of analytical :expr for iter_var in iterable [if cond_expr], Finally, the list is generated . alternative map() and lambda And filter() and lambda

8.13 Generator Expressions

8.14 R Related modules

Chapter9 Files and input and output - Page number :317

9.1 File object

9.2 File built-in functions [open() and file()]

File_object=open(file_name,access_mode=’r’,buffering=-1)

9.2.1 Factory function file()

9.2.2 Universal line breaks support (UNS)

9.3 File build in method :dir(file)

9.3.1 Input :read(),readline(),   readlines(): Change list to file , No line terminator

9.3.2 Output :write(),   writelines(): Change file to list , Line terminators are not removed

9.3.3 Move within file :seek()

9.3.4 File iteration :for eachline in f:

9.3.5 other :close()

9.3.6 File method miscellaneous :os modular , File built-in function finishing instructions .

9.3.6 File built-in properties ( Data attribute )

9.5 Standard document :sys modular

9.6 Command line arguments :sys.argv attribute

9.7 file system os Module and os.path Path name access function arrangement in module

9.8 File execution

9.9 Permanent memory module

9.9.1 pickle and marshal modular

9.9.2 DBM Style module

9.9.3 shelve modular

9.10 Related modules

Chapter10: Errors and exceptions - Page number :345

10.1 What is an anomaly

10.1.1 error

10.1.2 abnormal

10.2 Python The abnormal : each Error explain :NameError,ZeroDivisionError,SyntaxError,IOError,IndexError,KeyError,AttributeError

10.3 Detect and handle exceptions

10.3.1 try-except sentence : If something unusual happens ,try The remainder of the clause is ignored , The control flow immediately jumps to the corresponding processor . No exception occurred , Control flow is ignored except Statement continues execution .

10.3.2 Encapsulate built-in functions

10.3.3 With more than one except Of try sentence

10.3.4 Handling multiple exceptions except sentence

10.3.5 Catch all exceptions :try: except Exception,e:

BaseException:(KeyboardInterrupt,SystemExit,Exception, All built-in exceptions )

10.3.6 Abnormal parameter e

10.3.7 Use our encapsulated functions in the application

10.3.8 else Clause

10.3.9 finally Clause

10.3.10 try-finally sentence

10.3.11 try-except-else-finally: One pot in the kitchen

10.4 Context management

10.4.1 with sentence

10.4.2 * Context management protocol

10.5 * String as exception

10.6 An exception

Previous exceptions were thrown by the interpreter , And programmers are writing API The program can also trigger an exception .

10.6.1 raise sentence :raise Exception(‘[%s] Error message prompt ’[% Variable ])

raise Put the sentence in try In block ,if If the condition is satisfied raise( Throw an exception ), adopt except capture Exception abnormal .

10.7 Assertion

10.7.1 Assertions :assert expression[,’ Error message prompt ’]

Assert Put the sentence in try In block , adopt except capture AssertionError abnormal .

If the assertion succeeds , No measures will be taken .

If the assertion fails , The trigger AssertionError( Assertion error ) It's abnormal .AssertionError Exceptions can be used as well as other exceptions try-except Statement block capture , If not captured , He will terminate the program and prompt traceback.

10.8 Standard exception :Python Build in exception sorting , Exceptions are classes .

Root anomaly BaseException Subclasses of :KeyboardInterrupt,SystemExit,Exception

Exception Subclasses of : All other built-in exceptions

10.9* Create exception

10.10 Why use exception ( Now? )?

10.11 Why should it be abnormal ?

10.12 Exceptions and sys modular

10.13 Related modules

Chapter11: Functions and functional programming - Page number :388

11.1 What is a function ?

11.1.1 function VS The process : A function that does not return a value when a procedure is executed ( Implicitly returns the default value None)

11.1.2 Return value and function type

11.2 Call function

11.2.1 Function operators

11.2.2 Key parameters

11.2.3 Default parameters

11.2.4 Parameter group - Example

Through a tuple ( Non key parameters ) Or a dictionary ( Key parameters ) Passed as a parameter group to a function , You can put all the parameters into a tuple or dictionary . Such as :

func(*tuple_grp_nonkw_args,**dict_grp_kw_args)

11.3 Create a function

11.3.1 def sentence

11.3.2 Statement and definition comparison

11.3.3 The forward references

11.3.4 Function attribute

11.3.5 Inside / Nested Function

11.3.6 * function ( With the method ) Decorator

11.4 Transfer function :

1.def foo(): foo( A reference to a function object ) and foo()( Function object call )

2.foo As an input parameter to a function :foo1(foo)

11.5 Formal parameters

11.5.1 Positional arguments

11.5.2 Default parameters

11.6 Variable length parameters

11.6.1 Non keyword variable length parameter ( Tuples )

11.6.2 Keyword variable parameter (Dictionary)

11.6.3 Calling object functions with variable length arguments

11.7 Functional programming

11.7.1 Anonymous function and lambda

11.7.2 Built-in functions apply(),filter(),map(),reduce()

filter(func,seq) Filter , Select the sequence that is true ( What type of participation , What kind of results )

map(func,seq) mapping , Returns the result of calling the function , List the type .

reduce(func,seq),func It's a binary function , Only two parameters are accepted , Return to a single , And then get another value with the next element in the sequence , Know the whole iteration seq, Final , Returns a value .

11.7.3 Partial function applications

11.8 Variable scope

11.8.1 Global variables and local variables

11.8.2 globa sentence

11.8.3 Number of scopes

11.8.4 Closure

11.8.5 Scope and lambda

11.8.6 Variable scope and namespace

11.9 recursive

11.10 generator

11.10.1 Simple generator features

11.10.2 Enhanced generator features

notes :11.7.3-11.10.2 I didn't look at it carefully , Exercises not done .

Chapter12 modular - Page number :450

12.1 What is a module

12.2 Modules and files

12.2.1 Module namespace : The respective namespace is specified by the period attribute flag

12.2.2 Search path and path search PYTHONPATH and sys.path

12.3 The name space : Name to object mapping .

Three namespace : Local namespace , Global namespace , Built in namespace

12.3.1 Comparison of namespace and variable scope

12.3.2 Name search , Determine scope , Cover : Preferential local , The whole situation , Re built in .

12.3.3 Unlimited namespace

12.4 The import module

12.4.1 sentence :import: The order :Python Standard library module ,Python Third-party module , Application custom module

The interpreter executes to this statement , The specified module is found in the search path , Will load it .

12.4.2 from import sentence : It is the module properties that import the specified module from a[.b.c] import d

12.4.3 Multiline import :\

12.4.4 Extended import sentence (as):from a import b as c

12.5 Features of module import

12.5.1 Execute module on load

12.5.2 Import (import) And load (load): Loading occurs only on the first import

12.5.3 The name imported into the current namespace

12.5.4 The name that is imported into the importer scope

12.5.5 About __future__

12.5.6 Warning framework

12.5.7 from ZIP File import module (zip Documents including .py,.pyc,.pyo file )

12.5.8” new ” Import hook

12.6 Module built in function

12.6.1__import__()

12.6.2 globals() and locals()

12.6.3 reload()

12.7 package : standards-of-use import and from-import Statement to import the module in the package

12.7.1 Directory structure : Every bag has it __init__.py file

12.7.2 Use from –import Import package

12.7.3 Absolutely import : Name passed Python route (sys.path or PYTHONPATH) To visit

12.7.4 Relative Import : Period import

12.8 Other features of the module

12.8.1 Automatically loaded module :__builtin__ It will be imported automatically

12.8.2 Prevent property import : Attribute name preceded by _

12.8.3 Size insensitive import ?

12.8.4 Source code coding

12.8.5 Import loop ?

12.8.6 Module execution

12.9 Related modules

Chapter13 object-oriented programming OOP- Page number :473

13.1 Introduce :

13.1.1 Classes and class instances

A class is the definition of an object , And the example is “ Real objects ”, It stores the specific information of the object defined in the class .

class Class name ( Inherited parent class , Such as object):object yes “ Mother of all classes ”

13.1.2 Method : The popular name of a class is a method :def Method name (self)

Methods are defined in the definition of a class , But it can only be called by instances . So use self, Represents the instance object itself .

Defining classes ( And methods )2. Create examples 3. Call method with instance

13.1.3 Create a class ( Class definition )

__init__() Method : Initialize some values or operations ( For example, log in to the database ), Class is called implicitly __init__() Method , Complete sum of input parameters of instantiation __init__() The input parameters received by the method are consistent ( except self)

13.1.4 Create subclass

13.1.5 Name the class , attribute , Method Naming specification

Class name : Usually begins with a capital letter :AbcDef

attribute ( Variable or constant ): Noun : A lowercase letter :abc

Method : Use predicates ( Verb plus object ): A lowercase letter _ A lowercase letter :abc_def

13.2 object-oriented programming

13.2.1 Object oriented design OOD And object-oriented programming OOP The relationship between

13.2.2 Problems in the real world

13.2.3* Common terms

13.3 class

13.3.1 Create a class

13.3.2 Statement and definition : No difference between , At the same time

13.4 Class properties : Data and function elements that belong to an object , Access by period identifier . Before calling a method of a class , You need to create an instance .

13.4.1 Data properties of class

A data property is just a variable of a defined class . Does not depend on any class instances .

13.4.2 Method

Method applies only to objects of class type ( example )

13.4.3 Determine the properties of the class

adopt dir( Class name ) Or the name of the class .__dict__ Properties of viewable classes

13.4.4 Special class properties :__name__,__doc__,__bases__,__dict__,__module__,__class__

13.5 example

13.5.2 __init__()“ Constructors ” Method

When calling a class , Any parameters passed in are given to the __init__(),__init__() It is the first method that the interpreter creates after you create an instance. . another ,__init__() No objects are allowed to be put back ( Should be None

13.5.3 __new__() “ Constructors ” Method

13.5.4 __del__() “ Deconstructor ” Method

13.6 Instance attributes

Instance has only data properties ( Methods are strictly class properties )

13.6.1“ Instantiation ” Instance attributes ( Or create a better constructor )

13.6.2 View instance properties : adopt dir and __dict__ see

13.6.3 Special instance properties :__class__ and __dict__

13.6.4 Built in type properties

13.6.5 Instance attributes vs Class properties

13.7 Proofreading starts here — Binding and method calling

Methods are class properties . Method can only be called if the class to which it belongs has an instance , Method is bound to the instance . The first parameter of a method is a variable self.

13.7.1 Call binding method

13.7.2 Calling unbound methods : Derive a subclass , Methods that override the parent class .

13.8 Static methods and class methods : I didn't see it

13.8.1 staticmethod() and classmethod Built-in functions

13.8.2 Using function modifiers

13.9 Combine : Mix different classes into other classes

13.10 Subclasses and Derivations : The same class, but with some different functions

13.10.1 Create subclass

13.11 Inherit : Describes how the properties of the base class are passed on to the derived class . A subclass can inherit any property of its base class ( except __doc__).

13.11.1__bases__ Class properties

13.11.2 Override by inheritance (Overriding) Method : If the method name is the same , Give priority to subclasses' own methods .

13.11.3 Derive from standard type : I didn't see it

13.11.4 multiple inheritance : I didn't see it

13.12 class , Built in functions for instances and other objects

13.12.1 issubclass(): Is it a subclass issubclass(sub,sup)

13.12.2 isinstance(): Is it an instance isinstance(obj1,obj2)

13.12.3 hasattr(),getattr(),setattr(),delattr()

13.12.4 dir()

13.12.5 super()

13.12.6 vars()

13.13 Customizing classes with special methods : I didn't see it

13.13.1 Simple customization (RoundFloat2)

13.13.2 Numerical customization (Time60)

13.13.3 iterator (RandSeq and AnyIter)

13.13.4* Multi type customization (NumStr)

13.14 Privatization

13.15* to grant authorization

13.15.1 packing

13.15.2 Implement Authorization

13.16 Advanced features of new classes (Python 2.2+)

13.16.1 General features of new class

13.13.2__slots__ Class properties

13.16.3 Special methods __getattribute__()

13.16.4 The descriptor

13.16.5 Metaclasses( The metaclass ) and __metaclass__

13.17 Related modules and documents

Chapter14 execution environment - Page number :582  Look at it later.

14.1 Callable object : function , Method , class , And instances of classes

14.1.1 function : Built-in functions BIFs, User defined function UDF

14.1.2 Method : Built in method BIM, User defined methods UDM

14.1.3 class

14.1.4 Class :__call__

14.2 Code object

14.3 Executable object declaration and built-in function

14.3.1 callable()

14.3.2 compile()

14.3.3 eval()

14.3.4 exec

14.3 Executable object statements and built-in functions

14.3.5 input()

14.3.6 Use Python Build and execute at run time Python Code

14.4 Carry out other (Python) Program

14.4.1 Import

14.4.2 execfile()

14.4.3 Executing the module as a script

14.5 Carry out other ( Not Python) Program

14.5.1 os.system()

14.5.2 os.popen()

14.5.3 os.fork(),os.exec*(),os.wait*()

14.5.4 os.spawn*()

14.5.5 subprocess modular

14.5.6 Correlation function

14.6 Restricted execution

14.7 End to perform

14.7.1 sys.exit() and SystemExit

14.7.2 sys.exitfunc()

14.7.3 os._exit() Function os._exit() function

14.7.4 os.kill() Function

14.8 Various operating system interfaces

14.9 Related modules

Chapter15 Regular expressions - Page number :621

15.1 Introduce / motivation

15.1.1 Your first regular expression

15.2 Special symbols and characters used in regular expressions : Sorting out tables

15.2.1 Use the pipe symbol (|) Match multiple regular expression patterns

15.2.2 Matches any single character (.)

15.2.4 Start matching at the beginning or end of a string or at the word boundary (^ / $ / \b / \B)

15.2.5 Create character class ([]): Any character

15.2.5.1[] Range specified in (-) And negation (^)

15.2.6 Use the required operator (*,+,?,{}) Achieve multiple occurrences / Repeat match

15.2.7 Special characters represent character sets

15.2.8 Use parentheses (()) Set up a team : Adding a repeat operator to multiple characters

15.3 Regular expressions and python Language

15.3.1 re modular : Core functions and methods :compile,match,search,findall,finditer,split,sub,group,groups  : Functional pattern A regular expression

15.3.2 Use compile() Compile regular expressions

compile(pattern,flags=0)

15.3.3 Matching objects and group(),groups() Method

15.3.4 use match() Match string :

match(pattern,string,flags=0)

Match from the beginning : return regex object . adopt group Extracting matched characters .

15.3.5 search() Find a pattern in a string ( Comparison between search and matching ):

search(pattern,string,flags=0)

Match from anywhere : return regex object . adopt group Extracting matched characters .

15.3.6 Match multiple strings (|)

15.3.7 Match any single character (.): except \n

15.3.8 Create character set ([])

15.3.9 repeat , Special characters and subgroups :group(),groups() Arrangement

15.3.10 Matching from the beginning or end of a string and at the word boundary

15.3.11 use findall() Find each matching part that appears : Returns a list or an empty list

findall(pattern,string)

15.3.12 use sub[ and subn()] Search and replace : Return the replaced string

sub(pattern,string,max=0)

15.3.13 use split() Division ( Separation mode ): Returns a list of

re Of split Is to separate strings according to regular expressions . A string of split() Is separated by a fixed character .

split(pattern,string,max=0)

python Original string (raw strings) Usage of

15.4 Examples of regular expressions

15.4.1 Match a string

15.4.2 Comparison between search and matching ,“ greedy ” matching

Chapter16 Network programming - Page number :655

16. Introduce

16.1.1 What is a customer / Server architecture

16.1.2 Customer / Server network programming

16.2 Socket : Communication breakpoint

16.2.1 What is socket ? communication interface ?

Socket family : File based AF_UNIX And network-based AF_INET

16.2.2 Socket address : Host and port

16.2.3 Connection oriented SOCK_STREAM With no connection SOCK_DGRAM

16.3 Python Network programming in

16.3.1 socket() Module function

16.3.2 Socket object ( The built-in ) Method

Chapter17 Network client Programming - Page number :685

Chapter18 Multithreaded programming - Page number :721

Chapter19 Graphical user interface programming - Page number :748

Chapter20Web Programming - Page number :781

Chapter21 Database programming - Page number :841

Chapter22 expand Python- Page number :880

Chapter23 Other topics - Page number :901

Python Second edition of core programming ( chinese ).pdf More articles related to catalogue arrangement

  1. Refusal goes from entry to abandonment _《Python Programming core ( The second edition )》 Must read table of contents

    Catalog Catalog About the book Must see knowledge Last About the book <Python Programming core ( The second edition )> It's a book Python Introduction to programming , It is divided into Python The core ( It's not really the core , It should be called foundation ) and high ...

  2. Python Programming core ( The second edition )PDF

    Python Programming core ( The second edition ) Catalog The first 1 part Python Core No 1 Chapter Welcome to Python The world 1.1 What is? Python1.2 origin 1.3 characteristic 1.3.1 senior 1.3.2 object-oriented 1.3.3 Upgradeable ...

  3. python Notes on the second edition of core programming

    python Notes of the second edition of core programming are provided by netizens :open168 python Programming core -- note ( Very detailed , Recommended collection ) Interpreter options:1.1 –d    Provide debug output 1.2 –O    Generate optimized bytecode ( Generate ...

  4. python Second edition of core programming After-school exercises The first 11 Chapter

    11-3 function . In this exercise , We will achieve max() and min() Built-in functions . (a) Write with two elements to return a larger and smaller element , ordinary max2() nucleus min2() function . They should be able to use whatever they want pytho ...

  5. 《python Second edition of core programming 》 The first 8 Chapter exercises

    8–1. Conditional statements . Look at the code below # statement Aif x > 0:# statement Bpasselif x < 0:# statement Cpasselse:# s ...

  6. 《python Second edition of core programming 》 The first 7 Chapter exercises

    7–1. Dictionary method . Which dictionary method can be used to combine two dictionaries ? answer :dict1.update(dict2) 7–2. Key to dictionary . We know that dictionary values can be arbitrary Python object , What about the key of the dictionary ? Please try ...

  7. 《python Second edition of core programming 》 The first 5 Chapter exercises

    5-1 plastic Tell me about Python The difference between regular and long integers answer : Normal integer 32 position , What can long integer type express The values are only the same as those supported by your machine ( fictitious ) Memory size 5-2 Operator (a) Write a function , Calculates and returns the multiplication of two numbers ...

  8. 《python Second edition of core programming 》 The first 4 Chapter exercises

    4–1. Python object . With all the Python What are the three attributes related to objects ? Please make it simple

  9. 《python Second edition of core programming 》 The first 3 Chapter exercises

    3-1. identifier . Why? Python Variable name and variable type declaration are not required in ? answer : Object types and memory usage are determined at run time . Although the code is compiled into bytecode ,Python It's still an explanation Type language . At the time of creation, that is, assignment ...

Random recommendation

  1. CSS pseudo-classes

    Link The :link CSS pseudo-class lets you select links inside elements. This will select any link whi ...

  2. PHP Errors and exceptions Notes and summaries (5) Options related to error logging in the configuration file &amp;&amp; Log the error to the specified file

    [ Recording errors ( Production environment )] php.ini: ① Turn on / close Error log function log_errors = On ② Set up log_errors The maximum number of bytes log_errors_max_len = Its ...

  3. oracle linux Download and unload

    1. Close the database shutdown immeidate 2. stop it Listener lsnrctl stop 3. stop it http service ( Optional ) service httpd stop 4. use su Or heavy ...

  4. asp.net Various types of video playback code ( whole )

    1.avi Format The code snippet is as follows : <object id="video" width="400" height="200" border= ...

  5. Quickly build a high-speed and stable three-tier B/S framework

  6. Sencha Extjs4.2 Skin making

    1                 UI Component basis Study ExtJs It's the use of learning components .ExtJs4 The framework is reconstructed , One of the most important is to form a structured and hierarchical component system , These components form the Ext Control for . E ...

  7. springmvc annotation

    brief introduction : handler method Common annotations for parameter binding , We deal with it according to them Request The different content parts of are divided into four categories :( Mainly explain common types ) A. Handle requet uri part ( Here it means uri templat ...

  8. Use Sybmol Module to build the neural network

    Symbolic programming Previous articles , We introduced NDArray modular , It is MXNet The core module of data processing , We can use NDArray Complete a very rich mathematical operations . actually , We can use it NDArray To define neural networks , This kind of prescription ...

  9. Attention[Content]

    0. introduction The attention mechanism in neural network refers to the principle of human visual attention mechanism . That is, when the human eye focuses on a small area in the field of vision , More attention will be devoted to this area , That is to " high resolution " Focus on an area of the image , At the same time &qu ...

  10. c++builder XE6 Remote Debuger Remote debugging

    1. Remote target machine install D:\Program Files (x86)\Borland\Remote Debugger\20, There is no CD from the installed xe6 On the computer Bin Copy files under directory bccide.dll bo ...