Example: stock market

Programming in Python 3: A Complete Introduction to the ...

PtgProgramming in Python 3A Complete Introduction to the Python LanguageSecond EditionMark SummerfieldUpper Saddle River, NJ Boston Indianapolis San Franciscop New York Toronto Montreal London Munich Paris MadridpCapetown Sydney Tokyo Singapore Mexico CityFrom the Library of STEPHEN EISEMANptgMany of the designations used by manufacturers and sellers to distinguish their products are claimedas trademarks. Where those designations appear in this book, and the publisher was aware of atrademark claim, the designations have been printed with initial capital letters or in all author and publisher have taken care in the preparation of this book, but make no expressed orimplied warranty of any kind and assume no responsibility for errors or omissions.

ptg Programming in Python 3 A Complete Introduction to the Python Language Second Edition Mark Summerfield Upper Saddle River,NJ ·Boston ·Indianapolis·San Francisco p New York ·Toronto ·Montreal ·London ·Munich ·Paris·Madrid p Capetown ·Sydney ·Tokyo ·Singapore·Mexico City From the Library of STEPHEN EISEMAN

Tags:

  Introduction, Python, Complete, Python 3, A complete introduction, Python 3 a complete introduction to the python

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Programming in Python 3: A Complete Introduction to the ...

1 PtgProgramming in Python 3A Complete Introduction to the Python LanguageSecond EditionMark SummerfieldUpper Saddle River, NJ Boston Indianapolis San Franciscop New York Toronto Montreal London Munich Paris MadridpCapetown Sydney Tokyo Singapore Mexico CityFrom the Library of STEPHEN EISEMANptgMany of the designations used by manufacturers and sellers to distinguish their products are claimedas trademarks. Where those designations appear in this book, and the publisher was aware of atrademark claim, the designations have been printed with initial capital letters or in all author and publisher have taken care in the preparation of this book, but make no expressed orimplied warranty of any kind and assume no responsibility for errors or omissions.

2 No liability isassumed for incidental or consequential damages in connection with or arising out of the use of theinformation or programs contained publisher offers excellent discounts on this book when ordered in quantity for bulk purchasesor special sales, which may include electronic versions and/or custom covers and content particularto your business, training goals, marketing focus, and branding interests. For more information,please contact: Corporate and Government Sales (800) 382-3419 sales outside the United States, please contact: International Sales us on the Web: of Congress Cataloging-in-Publication DataSummerfield, Mark.

3 Programming in Python 3 : a Complete Introduction to the Python language / MarkSummerfield. 2nd ed. p. cm. Includes bibliographical references and index. ISBN 978-0-321-68056-3 (pbk. : alk. paper)1. Python (Computer program language) 2. Object-oriented Programming (Computer science) I. Title. 2010 3 dc222009035430 Copyright 2010 Pearson Education, rights reserved. Printed in the United States of America. This publication is protected bycopyright, and permission must be obtained from the publisher prior to any prohibited reproduction,storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,photocopying, recording, or likewise.

4 For information regarding permissions, write to:Pearson Education, and Contracts Department501 Boylston Street, Suite 900 Boston, MA 02116 Fax: (617) 671-3447 ISBN-13: 978-0-321-68056-3 ISBN-10:0-321-68056-1 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, printing, November 2009 From the Library of STEPHEN EISEMANptgIn memory ofFranco Rabaiotti1961 2001 From the Library of STEPHEN EISEMANptgContents at a GlanceList of 1 Chapter 1. Rapid Introduction to Procedural 9 Chapter 2.

5 Data 51 Chapter 3. Collection Data 107 Chapter 4. Control Structures and 159 Chapter 5. 6. Object-Oriented 233 Chapter 7. File 8. Advanced Programming 339 Chapter 9. Debugging, Testing, and 413 Chapter 10. Processes and 439 Chapter 11. 12. Database 13. Regular 489 Chapter 14. Introduction to 513 Chapter 15. Introduction to GUI the Library of STEPHEN EISEMANptgContentsList of Introduction to Procedural 9 Creating and Running Python 9 Python s Beautiful Heart .. 14 Piece #1: Data 14 Piece #2: Object 16 Piece #3: Collection Data 18 Piece #4: Logical 21 Piece #5: Control Flow 26 Piece #6: Arithmetic 30 Piece #7: 33 Piece #8.

6 Creating and Calling 47 Chapter 51 Identifiers and 51 Integral 58 Floating-Point 58 Floating-Point 59 Complex 62 Decimal 65 Comparing 68 Slicing and Striding 69 String Operators and 71ixFrom the Library of STEPHEN EISEMANptgString Formatting with the () 78 Character 104 Chapter Data 107 Sequence 108 Named 113 Set 121 Frozen 125 Mapping 126 Default 135 Ordered 136 Iterating and Copying 138 Iterators and Iterable Operations and 138 Copying 158 Chapter Structures and 159 Control 159 Conditional 161 Exception 163 Catching and Raising 163 Custom 168 Custom 171 Names and 176 Argument and Parameter 177xFrom the Library of STEPHEN EISEMANptgAccessing

7 Variables in the Global 180 Lambda 183 Example: 192 Chapter 195 Modules and 199 Custom 202 Overview of Python s Standard 212 String 213 Command-Line 214 Mathematics and 216 Times and 216 Algorithms and Collection Data 217 File Formats, Encodings, and Data 219 File, Directory, and Process 222 Networking and Internet 226 Other 231 Chapter 233 The Object-Oriented 234 Object-Oriented Concepts and 235 Custom 238 Attributes and 238 Inheritance and 243 Using Properties to Control Attribute 246 Creating Complete Fully Integrated Data 248 Custom Collection 261 Creating Classes That Aggregate 261 Creating Collection Classes Using 269 Creating Collection Classes Using 285xiFrom the Library of STEPHEN EISEMANptgChapter 287 Writing and

8 Reading Binary 292 Pickles with Optional 292 Raw Binary Data with Optional 295 Writing and Parsing Text 305 Writing 305 Parsing 307 Parsing Text Using Regular 310 Writing and Parsing XML 312 Element 313 DOM (Document Object Model).. 316 Manually Writing 319 Parsing XML with SAX (Simple API for XML).. 321 Random Access Binary 324A Generic BinaryRecordFile 324 Example: The BikeStock Module s 337 Chapter Programming 339 Further Procedural 340 Branching Using 340 Generator Expressions and 341 Dynamic Code Execution and Dynamic 344 Local and Recursive 351 Function and Method 356 Function 360 Further Object-Oriented 363 Controlling Attribute 367 Context 372 Class 378 Abstract Base 380 Multiple 390 Functional-Style 395 Partial Function 398xiiFrom the Library of STEPHEN 399 Example.

9 411 Chapter , Testing, and 414 Dealing with Syntax 414 Dealing with Runtime 415 Scientific 420 Unit 437 Chapter and 439 Using the Multiprocessing 440 Using the Threading 444 Example: A Threaded Find Word 446 Example: A Threaded Find Duplicate Files 455 Chapter 457 Creating a TCP 458 Creating a TCP 471 Chapter 475 DBM 476 SQL 488 Chapter 489 Python s Regular Expression 490 Characters and Character 491 Grouping and 494 Assertions and 496 The Regular Expression 499xiiiFrom the Library of STEPHEN 510 Chapter to 513 BNF Syntax and Parsing 514 Writing Handcrafted 519 Simple Key Value Data 519 Playlist Data 522 Parsing the Blocks Domain-Specific 525

10 Pythonic Parsing with 534A Quick Introduction to 535 Simple Key Value Data 539 Playlist Data 541 Parsing the Blocks Domain-Specific 543 Parsing First-Order 548 Lex/Yacc-Style Parsing with 553 Simple Key Value Data 555 Playlist Data 557 Parsing the Blocks Domain-Specific 559 Parsing First-Order 568 Chapter to GUI 569 Dialog-Style 572 Main-Window-Style 578 Creating a Main 578 Creating a Custom 595 Selected 599xivFrom the Library of STEPHEN EISEMANptgList of s Operators and Conversion Bitwise Math Module s Functions and Constants # Math Module s Functions and Constants # s String Methods # Methods # Methods # Methods and Iterable Operators and Special Special and Bitwise Special Special and Bytearray Methods # and Bytearray Methods # and Bytearray Methods # Object Attributes and Methods # Object Attributes and Methods # Programming and Introspection Access Special Numbers Module s Abstract Base Module s Main


Related search queries