非常好的一本书,简介易懂,讲解清晰
Contents
1 Starting Out
1.1 RunningPython
2 Literals 11
2.1 Integers
2.2 RealNumbers
2.3 Strings
2.4 True,False,andNone
2.5 Lists
2.6 IndexingintoLists
3 Combining Literals
3.1 Numericoperators
3.2 Comparingthings
3.3 Combiningcomparisons
4 Precedence and Associativity
4.1 Precedence
4.2 Associativity
5 Variables
5.1 Variables
5.2 Variablenaming
6 Assignment
6.1 PrecedenceandAssociativityofAssignment
6.2 AssignmentPatterns
6.2.1 TheTransferPattern
6.2.2 TheUpdatePattern
6.2.3 TheThrow-awayPattern
6.2.4 TheThrow-awayPatternandFunctions
6.3 AboutPatterns
6.4 AssignmentandLists
7 Conditionals
7.1 Logicalexpressions
7.2 Logicaloperators
7.3 Shortcircuiting
7.4 Ifexpressions
7.5 if-elif-elsechains
8 Functions
8.1 Encapsulatingaseriesofoperations
8.2 Passingarguments
8.3 Creatingfunctionsonthefly
8.4 TheFunctionandProcedurePatterns
9 Python Programs and Using Files
9.1 Yourfirstprogram
9.2 VimandPython
9.3 ANeatMacro
9.4 WritingPythonPrograms
9.5 Orderofdefinitions
9.6 Importingcode
10 Input and Output
10.1Readingfromthekeyboard
10.2WritingtotheConsole
10.3ReadingfromtheCommandLine
10.3.1 Whatcommand-lineargumentsare
10.4ReadingfromFiles
10.5WritingtoaFile
11 More about Functions
11.1Built-inFunctions
11.2Functionsyntax
11.3FunctionObjects
11.4CallingFunctions
11.5Returningfromfunctions
12 Scope
12.1InScopeorOut
12.1.1 TheLocalVariablePattern
12.1.2 TheNon-localVariablePattern
12.1.3 TheAccessibleVariablePattern
12.1.4 TheTintedWindowsPattern
12.1.5 TintedWindowswithParallelScopes
12.2Alternateterminology
12.3ThreeScopeRules
12.4Shadowing
12.5Modules
13 Recursion
13.1Thepartsofarecursivefunction
13.2Thegreatestcommondivisor
13.3TheFibonaccisequence
13.4Manipulatinglistswithrecursion
13.5Thecountingpattern
13.6Theaccumulatepattern
13.7Thefiltered-countandfiltered-accumulatepatterns
13.8Thefilterpattern
13.9Themappattern
13.10Thesearchpattern
13.11Theshufflepattern
13.12Themergepattern
13.13Thegenericmergepattern
13.14Thefossilizedpattern
13.15Thebottomlesspattern
14 Loops
14.1Otherloops
14.2Thecountingpattern
14.3Thefiltered-countpattern
14.4Theaccumulatepattern
14.5Thefiltered-accumulatepattern
14.6Thesearchpattern
14.7Thefilterpattern
14.8Theextremepattern
14.9Theextreme-indexpattern
14.10Theshufflepattern
14.11Themergepattern
14.12ThefossilizedPattern
14.13Themissed-conditionpattern
15 Comparing Recursion and Looping
15.1Factorial
15.2Thegreatestcommondivisor
15.3TheFibonaccisequence
15.4CHALLENGE:Transformingloopsintorecursions
16 More on Input
16.0.1Convertingcommandlineargumentsenmass
16.1Readingindividualitemsfromfiles
16.2ReadingTokensintoaList
16.3ReadingRecordsintoaList
16.4 Creating a List of Records
16.5OtherScannerMethods
17 Arrays and Lists
17.0.1 Getting the array and list modules
17.1Aquickintroductiontodatastructures
17.2 Arrays
17.2.1 Creatingarrays
17.2.2 Settingandgettingarrayelements
17.2.3 Limitationsonarrays
17.3 Lists
17.3.1Listcreation
17.4 Mixing arrays and lists
17.5 Shallow versus deep copies
17.6 Changing the tail of a list
17.7 Inserting into the middle of a list
17.8 Objects
18 Sorting 113
18.1 Merge sort