Previous Page of 116Next Page

Python Tutorial

spinner.gif

Python Tutorial

Release 2.6.4

Guido van Rossum

Fred L. Drake, Jr., editor

November 25, 2009

Python Software Foundation

Email: docs@python.org

CONTENTS

1 Whetting Your Appetite 3

2 Using the Python Interpreter 5

2.1 InvokingtheInterpreter ....................................... 5

2.2 TheInterpreterandItsEnvironment ................................. 6

3 An Informal Introduction to Python 9

3.1 UsingPythonasaCalculator .................................... 9

3.2 FirstStepsTowardsProgramming .................................. 17

4 More Control Flow Tools 19

4.1 ifStatements ............................................ 19

4.2 forStatements ........................................... 19

4.3 The range()Function....................................... 20

4.4 breakand continueStatements, and elseClausesonLoops ................. 20

4.5 passStatements........................................... 21

4.6 DefiningFunctions .......................................... 21

4.7 MoreonDefiningFunctions ..................................... 23

4.8 Intermezzo:CodingStyle ...................................... 26

5 Data Structures 29

5.1 MoreonLists ............................................. 29

5.2 The delstatement.......................................... 33

5.3 TuplesandSequences ........................................ 33

5.4 Sets.................................................. 34

5.5 Dictionaries.............................................. 35

5.6 LoopingTechniques ......................................... 35

5.7 MoreonConditions ......................................... 36

5.8 ComparingSequencesandOtherTypes ............................... 37

6 Modules 39

6.1 MoreonModules .......................................... 40

6.2 StandardModules .......................................... 42

6.3 The dir()Function......................................... 42

6.4 Packages ............................................... 43

7 Input and Output 47

7.1 FancierOutputFormatting ...................................... 47

7.2 ReadingandWritingFiles ...................................... 50

8 Errors and Exceptions 53

8.1 SyntaxErrors ............................................. 53

8.2 Exceptions .............................................. 53

Previous Page of 116Next Page

Comments & Reviews (1)

Login or Facebook Sign in with Twitter


library_icon_grey.png Add share_icon_grey.png Share

Who's Reading

Recommended