Learning Python CFM

Learning Python Cfm-PDF Download

  • Date:17 Sep 2020
  • Views:3
  • Downloads:0
  • Pages:1213
  • Size:7.03 MB

Share Pdf : Learning Python Cfm

Download and Preview : Learning Python Cfm


Report CopyRight/DMCA Form For : Learning Python Cfm


Transcription:

Learning Python,FOURTH EDITION,Learning Python, Beijing Cambridge Farnham K ln Sebastopol Taipei Tokyo. Learning Python Fourth Edition,by Mark Lutz,Copyright 2009 Mark Lutz All rights reserved. Printed in the United States of America, Published by O Reilly Media Inc 1005 Gravenstein Highway North Sebastopol CA 95472. O Reilly books may be purchased for educational business or sales promotional use Online editions. are also available for most titles http my safaribooksonline com For more information contact our. corporate institutional sales department 800 998 9938 or corporate oreilly com. Editor Julie Steele Indexer John Bickelhaupt, Production Editor Sumita Mukherji Cover Designer Karen Montgomery. Copyeditor Rachel Head Interior Designer David Futato. Production Services Newgen North America Illustrator Robert Romano. Printing History,March 1999 First Edition,December 2003 Second Edition.
October 2007 Third Edition,September 2009 Fourth Edition. Nutshell Handbook the Nutshell Handbook logo and the O Reilly logo are registered trademarks of. O Reilly Media Inc Learning Python the image of a wood rat and related trade dress are trademarks. of O Reilly Media Inc, Many of the designations used by manufacturers and sellers to distinguish their products are claimed as. trademarks Where those designations appear in this book and O Reilly Media Inc was aware of a. trademark claim the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book the publisher and author assume. no responsibility for errors or omissions or for damages resulting from the use of the information con. tained herein,ISBN 978 0 596 15806 4,1252944666,You are my life. Table of Contents,Preface xxxi,Part I Getting Started. 1 A Python Q A Session 3,Why Do People Use Python 3.
Software Quality 4,Developer Productivity 5,Is Python a Scripting Language 5. OK but What s the Downside 7,Who Uses Python Today 7. What Can I Do with Python 9,Systems Programming 9,Internet Scripting 10. Component Integration 10,Database Programming 11,Rapid Prototyping 11. Numeric and Scientific Programming 11,Gaming Images Serial Ports XML Robots and More 12.
How Is Python Supported 12,What Are Python s Technical Strengths 13. It s Object Oriented 13,It s Free 13,It s Portable 14. It s Powerful 15,It s Mixable 16,It s Easy to Use 16. It s Easy to Learn 17,It s Named After Monty Python 17. How Does Python Stack Up to Language X 17,Chapter Summary 18.
Test Your Knowledge Quiz 19,Test Your Knowledge Answers 19. 2 How Python Runs Programs 23,Introducing the Python Interpreter 23. Program Execution 24,The Programmer s View 24,Python s View 26. Execution Model Variations 29,Python Implementation Alternatives 29. Execution Optimization Tools 30,Frozen Binaries 32.
Other Execution Options 33,Future Possibilities 33. Chapter Summary 34,Test Your Knowledge Quiz 34,Test Your Knowledge Answers 34. 3 How You Run Programs 35,The Interactive Prompt 35. Running Code Interactively 37,Why the Interactive Prompt 38. Using the Interactive Prompt 39,System Command Lines and Files 41.
A First Script 42,Running Files with Command Lines 43. Using Command Lines and Files 44,Unix Executable Scripts 46. Clicking File Icons 47,Clicking Icons on Windows 47. The input Trick 49,Other Icon Click Limitations 50. Module Imports and Reloads 51,The Grander Module Story Attributes 53.
import and reload Usage Notes 56,Using exec to Run Module Files 57. The IDLE User Interface 58,IDLE Basics 58,Using IDLE 60. Advanced IDLE Tools 62,Other IDEs 63,Other Launch Options 64. viii Table of Contents,Embedding Calls 64,Frozen Binary Executables 65. Text Editor Launch Options 65,Still Other Launch Options 66.
Future Possibilities 66,Which Option Should I Use 66. Chapter Summary 68,Test Your Knowledge Quiz 68,Test Your Knowledge Answers 69. Test Your Knowledge Part I Exercises 70,Part II Types and Operations. 4 Introducing Python Object Types 75,Why Use Built in Types 76. Python s Core Data Types 77,Numbers 78,Strings 80,Sequence Operations 80.
Immutability 82,Type Specific Methods 82,Getting Help 84. Other Ways to Code Strings 85,Pattern Matching 85,Sequence Operations 86. Type Specific Operations 87,Bounds Checking 87,Nesting 88. Comprehensions 88,Dictionaries 90,Mapping Operations 90. Nesting Revisited 91,Sorting Keys for Loops 93,Iteration and Optimization 94.
Missing Keys if Tests 95,Why Tuples 97,Other File Like Tools 99. Other Core Types 99,How to Break Your Code s Flexibility 100. Table of Contents ix,User Defined Classes 101,And Everything Else 102. Chapter Summary 103,Test Your Knowledge Quiz 103,Test Your Knowledge Answers 104. 5 Numeric Types 105,Numeric Type Basics 105,Numeric Literals 106.
Built in Numeric Tools 108,Python Expression Operators 108. Numbers in Action 113,Variables and Basic Expressions 113. Numeric Display Formats 115,Comparisons Normal and Chained 116. Division Classic Floor and True 117,Integer Precision 121. Complex Numbers 122,Hexadecimal Octal and Binary Notation 122.
Bitwise Operations 124,Other Built in Numeric Tools 125. Other Numeric Types 127,Decimal Type 127,Fraction Type 129. Booleans 139,Numeric Extensions 140,Chapter Summary 141. Test Your Knowledge Quiz 141,Test Your Knowledge Answers 141. 6 The Dynamic Typing Interlude 143, The Case of the Missing Declaration Statements 143.
Variables Objects and References 144,Types Live with Objects Not Variables 145. Objects Are Garbage Collected 146,Shared References 148. Shared References and In Place Changes 149,Shared References and Equality 151. Dynamic Typing Is Everywhere 152,Chapter Summary 153. Test Your Knowledge Quiz 153,Test Your Knowledge Answers 154.
x Table of Contents,7 Strings 155,String Literals 157. Single and Double Quoted Strings Are the Same 158,Escape Sequences Represent Special Bytes 158. Raw Strings Suppress Escapes 161,Triple Quotes Code Multiline Block Strings 162. Strings in Action 163,Basic Operations 164,Indexing and Slicing 165. String Conversion Tools 169,Changing Strings 171,String Methods 172.
String Method Examples Changing Strings 174,String Method Examples Parsing Text 176. Other Common String Methods in Action 177,The Original string Module Gone in 3 0 178. String Formatting Expressions 179,Advanced String Formatting Expressions 181. Dictionary Based String Formatting Expressions 182. String Formatting Method Calls 183,The Basics 184,Adding Keys Attributes and Offsets 184. Adding Specific Formatting 185,Comparison to the Formatting Expression 187.
Why the New Format Method 190,General Type Categories 193. Types Share Operation Sets by Categories 194,Mutable Types Can Be Changed In Place 194. Chapter Summary 195,Test Your Knowledge Quiz 195,Test Your Knowledge Answers 196. 8 Lists and Dictionaries 197,Lists in Action 200,Basic List Operations 200. List Iteration and Comprehensions 200,Indexing Slicing and Matrixes 201.
Changing Lists In Place 202,Dictionaries 207,Dictionaries in Action 209. Basic Dictionary Operations 209,Changing Dictionaries In Place 210. Table of Contents xi,More Dictionary Methods 211,A Languages Table 212. Dictionary Usage Notes 213,Other Ways to Make Dictionaries 216. Dictionary Changes in Python 3 0 217,Chapter Summary 223.
Test Your Knowledge Quiz 224,Test Your Knowledge Answers 224. 9 Tuples Files and Everything Else 225,Tuples 225,Tuples in Action 227. Why Lists and Tuples 229,Opening Files 230,Using Files 231. Files in Action 232,Other File Tools 238,Type Categories Revisited 239. Object Flexibility 241,References Versus Copies 241.
Comparisons Equality and Truth 244,Python 3 0 Dictionary Comparisons 246. The Meaning of True and False in Python 246,Python s Type Hierarchies 248. Type Objects 249,Other Types in Python 250,Built in Type Gotchas 251. Assignment Creates References Not Copies 251,Repetition Adds One Level Deep 252. Beware of Cyclic Data Structures 252,Immutable Types Can t Be Changed In Place 253.
Chapter Summary 253,Test Your Knowledge Quiz 254,Test Your Knowledge Answers 254. Test Your Knowledge Part II Exercises 255,Part III Statements and Syntax. 10 Introducing Python Statements 261,Python Program Structure Revisited 261. Python s Statements 262,xii Table of Contents,A Tale of Two ifs 264. What Python Adds 264,What Python Removes 265,Why Indentation Syntax 266.
A Few Special Cases 269,A Quick Example Interactive Loops 271. A Simple Interactive Loop 271,Doing Math on User Inputs 272. Handling Errors by Testing Inputs 273,Handling Errors with try Statements 274. Nesting Code Three Levels Deep 275,Chapter Summary 276. Test Your Knowledge Quiz 276,Test Your Knowledge Answers 277.
11 Assignments Expressions and Prints 279,Assignment Statements 279. Assignment Statement Forms 280,Sequence Assignments 281. Extended Sequence Unpacking in Python 3 0 284,Multiple Target Assignments 288. Augmented Assignments 289,Variable Name Rules 292,Expression Statements 295. Expression Statements and In Place Changes 296,Print Operations 297.
The Python 3 0 print Function 298,The Python 2 6 print Statement 300. Print Stream Redirection 302,Version Neutral Printing 306. Chapter Summary 308,Test Your Knowledge Quiz 308,Test Your Knowledge Answers 308. 12 if Tests and Syntax Rules 311,if Statements 311. General Format 311,Basic Examples 312,Multiway Branching 312.
Python Syntax Rules 314,Block Delimiters Indentation Rules 315. Statement Delimiters Lines and Continuations 317,A Few Special Cases 318. Table of Contents xiii,Truth Tests 320,The if else Ternary Expression 321. Chapter Summary 324,Test Your Knowledge Quiz 324,Test Your Knowledge Answers 324. 13 while and for Loops 327,while Loops 327,General Format 328.
Examples 328,break continue pass and the Loop else 329. General Loop Format 329,continue 331,Loop else 332. for Loops 334,General Format 334,Examples 335,Loop Coding Techniques 341. Counter Loops while and range 342,Nonexhaustive Traversals range and Slices 343. Changing Lists range 344,Parallel Traversals zip and map 345.
Generating Both Offsets and Items enumerate 348,Chapter Summary 349. Test Your Knowledge Quiz 349,Test Your Knowledge Answers 350. 14 Iterations and Comprehensions Part 1 351,Iterators A First Look 351. The Iteration Protocol File Iterators 352,Manual Iteration iter and next 354. Other Built in Type Iterators 356,List Comprehensions A First Look 358.
List Comprehension Basics 359,Using List Comprehensions on Files 359. Extended List Comprehension Syntax 361,Other Iteration Contexts 362. New Iterables in Python 3 0 366,The range Iterator 367. The map zip and filter Iterators 368,Multiple Versus Single Iterators 369. Who Uses Python Today 7 What Can I Do with Python 9 Systems Programming 9 GUIs 9 Internet Scripting 10 Component Integration 10 Database Programming 11 Rapid Prototyping 11 Numeric and Scientific Programming 11 Gaming Images Serial Ports XML Robots and More 12 How Is Python Supported 12 What Are Python s Technical Strengths 13

Related Books