A Python Book Beginning Python Advanced Python and Python Exercises-3
A Python Book Beginning Python Advanced Python and Python Exercises-3
Python Book
Contents
1 Part 1 Beginning Python...........................................................................................10
1.1 Introductions Etc...................................................................................................10
1.1.1 Resources.......................................................................................................11
1.1.2 A general description of Python....................................................................12
1.1.3 Interactive Python..........................................................................................15
1.2 Lexical matters......................................................................................................15
1.2.1 Lines..............................................................................................................15
1.2.2 Comments......................................................................................................16
1.2.3 Names and tokens..........................................................................................16
1.2.4 Blocks and indentation..................................................................................16
1.2.5 Doc strings.....................................................................................................17
1.2.6 Program structure..........................................................................................17
1.2.7 Operators.......................................................................................................18
1.2.8 Also see.........................................................................................................19
1.2.9 Code evaluation.............................................................................................19
1.3 Statements and inspection preliminaries...........................................................20
1.4 Builtin datatypes.................................................................................................21
1.4.1 Numeric types................................................................................................21
1.4.2 Tuples and lists..............................................................................................21
1.4.3 Strings............................................................................................................24
1.4.3.1 The new string.format method...............................................................26
1.4.3.2 Unicode strings......................................................................................27
1.4.4 Dictionaries....................................................................................................29
1.4.5 Files...............................................................................................................32
1.4.6 Other builtin types........................................................................................35
1.4.6.1 The None value/type..............................................................................35
1.4.6.2 Boolean values.......................................................................................36
1.4.6.3 Sets and frozensets.................................................................................36
1.5 Functions and Classes A Preview......................................................................36
1.6 Statements.............................................................................................................37
1.6.1 Assignment statement....................................................................................37
1.6.2 import statement............................................................................................39
1.6.3 print statement...............................................................................................41
1.6.4 if: elif: else: statement...................................................................................43
1.6.5 for: statement.................................................................................................44
1.6.6 while: statement.............................................................................................48
Page 3