Learning Python 5th Edition Mark Lutz

所需积分/C币:10 2017-10-24 10:27:03 7.2MB PDF
收藏 收藏

Learning Python 5th Edition Mark Lutz
FIFTH EDITION Learning Python Mark lut O'REILLY Beijing: ambridge· Farnham·Kdln· Sebastopol· Tokyo Learning Python, Fifth Edition by mark lutz Copyright@ 2013 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 arealsoavailableformosttitles(http://my.safaribooksonline.com).Formoreinformationcontactour corporate/institutional sales department: 800-998-9938 or corporate(oreilly con Editor: Rachel roumeliotis Indexer: Lucie haskins Production Editor: Christopher Hearse Cover designer: Randy Comer Copyeditor: Rachel monaghan Interior Designer: David Futato Proofreader: Julie Van Keuren Illustrator: Rebecca demarest June 2013 Fifth edition Revision History for the Fifth Edition 2013-06-07 First release Seehttp:/oreilly.com/catalog/errata.csp?isbn=9781449355739forreleasedetails Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly media, Inc. Learning Python, 5th Edition, 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 rademarks. 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 authors assume no responsibility for errors or omissions, or for damages resulting trom the use of the information con tained herein ISBN:978-1-449-35573-9 1370970520 To Ve You are my life Table of contents Preface XX Part Getting Started 1. A Python Q&A Session Why do People use Python Software Quality Developer Productivity Is Python a“ Scripting language”? OK. but What's the Downside? 7 Who Uses Python Today What Can I Do with Python? 10 Systems Programming GUIs Internet Scripting Component Integration 12 Database Programming Rapid prototyping Numeric and Scientific Programming 13 And More: Gaming, Images, Data Mining, Robots, Exce 14 How Is Python Developed and Supported? Open Source tradeoffs What Are Pythons Technical Strengths? 16 It's Object-Oriented and Functional 16 It's free It's portable It's powerful 18 It's mixable It's Relatively easy to use 19 It's Relatively easy to Learn t's Named After Monty python 20 How Does Python Stack Up to Language X? Chapter Summary 22 Test Your Knowledge: Quiz Test Your Knowledge: Answers 23 2. How Python Runs Programs ,27 Introducing the Python Interpreter Program Execution 28 The Programmer's view 28 Python's view 30 Execution Model variations 33 Python Implementation alternatives Execution Optimization Tools Frozen binaries 39 Possibilities? 40 Chapter summary Test Your Knowledge: QI 41 Test Your Knowledge: Answers 3. How You run Programs The Interactive Prompt Starting an lnteractive session The System Path 45 New Windows Options in 3.3 PATH, Launcher Where to Run Code directories 47 What not to t P e: Prompts aI nd comments 48 Running code interactively 49 Why the Interactive Prompt 50 Usage Notes: The Interactive Prompt 52 ystem Command Lines and files 54 A First Script 55 Running Files with Command Lines 56 Command-Line Usage Variations Usage Notes: Command Lines and files 58 Unix-Style Executable Scripts:#! Unix Script basics The Unix env Lookup Trick The Python 3. 3 Windows Launcher:#! Comes to Windows Clicking File icons Icon-Click Basics 62 Clicking Icons on Windows 63 The input Trick on Windows Other Icon-Click Limitations 66 ⅵ i Table of Contents Module imports and reloads Import and reload basics 66 The Grander Module Story: Attributes 68 Usage Notes: import and reload 71 Using exec to Run Module Files The iDle User interface 73 IDLE Startup details 74 IDLE Basic Usage 75 IDLE USability Features 76 Advanced IDle Tools 77 sage Notes: IDLE Other ides Other Launch Options 81 Embedding Calls 81 Frozen Binary executables 82 Text Editor Launch Options 8 Still Other launch options Future possibilities Which Option Should I Use? Chapter Summary Test Your knowledge: Quiz 85 Test Your Knowledge: Answers Test Your Knowledge: Part I Exercises Part Il. Types and Operations 4. Introducing Python Object Types............. The Python Conceptual Hierarchy 93 Why Use Built-in t' 94 Python's Core Data Types 95 rings 99 Sequence operations 99 Immutability 101 Type-Specific Methods 102 Getting Help 104 Other Ways to Code Strings 105 ncode strings 106 Pattern Matching 108 Sequence operations 109 109 Table of contents|ⅶi Bounds Checking Nesting 110 mp nsions Dictionaries 113 Mapping Operations 114 Nesting revisited 115 Missing Keys: if Tests 116 Sorting keys: for loops 118 Iteration and Optimization 120 121 Why Tuples? 12 Binary bytes File 123 Unicode Text files 124 Other File-Like tools 126 Other Core type 126 How to Break Your Code's Flexibilit 128 User-Defined Classes 129 And Everything else 130 Chapter Summary 130 Test Your knowledge: Quiz 131 Test Your knowledge: Answers 131 5. Numeric Types 133 Numeric Type basics 133 Numeric literals 134 Built-in Numeric tools 136 Python Expression Operators 136 Numbers in action 141 Variables and Basic Expressions 141 Numeric Display Formats 143 Comparisons: Normal and chained 144 Division Classic Floor and true 146 Integer Precision 150 Complex numbers 151 Hex, octal, Binary: Literals and Conversions 151 Bitwise operations 153 Other Built-in Numeric tools 155 Other Numeric types 157 Decimal Type 157 Fraction Type 160 163 Booleans 171 ⅶ ii Table of Contents

试读 127P Learning Python 5th Edition Mark Lutz
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
Learning Python 5th Edition Mark Lutz 10积分/C币 立即下载
Learning Python 5th Edition Mark Lutz第1页
Learning Python 5th Edition Mark Lutz第2页
Learning Python 5th Edition Mark Lutz第3页
Learning Python 5th Edition Mark Lutz第4页
Learning Python 5th Edition Mark Lutz第5页
Learning Python 5th Edition Mark Lutz第6页
Learning Python 5th Edition Mark Lutz第7页
Learning Python 5th Edition Mark Lutz第8页
Learning Python 5th Edition Mark Lutz第9页
Learning Python 5th Edition Mark Lutz第10页
Learning Python 5th Edition Mark Lutz第11页
Learning Python 5th Edition Mark Lutz第12页
Learning Python 5th Edition Mark Lutz第13页
Learning Python 5th Edition Mark Lutz第14页
Learning Python 5th Edition Mark Lutz第15页
Learning Python 5th Edition Mark Lutz第16页
Learning Python 5th Edition Mark Lutz第17页
Learning Python 5th Edition Mark Lutz第18页
Learning Python 5th Edition Mark Lutz第19页
Learning Python 5th Edition Mark Lutz第20页

试读结束, 可继续阅读

10积分/C币 立即下载