Learning Python 5th edition

所需积分/C币:9 2018-01-15 21:40:17 14.47MB PDF
24
收藏 收藏
举报

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to prog
FIFTH EDITION Learning Python Mark Lutz ORE|LLY° bel]ing· ambridge. Farnham:Kdln· Sebastopol· Tokyo Learning Python, Fifth Edition by mark lut Copyright o 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/institutionalsalesdepartment800-998-9938orcorporate@oreilly.com 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 201 Fifth Edition Revision History for the Fifth Edition 2013-06-07 First release Seehttp://oreilly.com/catalog/errata.csp?isbn=9781449355739forreleasedetails Nutshell Handbook th ok logo, and the O'Reilly logo are regi O'Reilly Media, Inc. Learning Python, Sth 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 trademarks. Where those designations appear in this book, and O'Reilly media 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 from 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 L. 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? 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 And More: Gaming, Images, Data Mining, Robots, Excel 14 How Is Python Developed and Supported pen 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 It's Named After Monty Python How Does Python Stack Up to language X? Chapter summary 2 Test Your Knowledge: Quiz Test Your Knowledge: Answers 23 2. How Python runs Programs............. ,27 Introducing the Python Interpreter 27 Program Execution 28 The Programmers view 28 Python's View 30 Execution Model variations 33 Python Implementation alternatives Execution Optimization Tools 37 Frozen binaries 39 Future possibilities? 40 Chapter summary Test Your Knowledge: Quiz Test Your Knowledge: Answers 41 3. How You run programs The Interactive Prompt Starting an Interactive session The System Path 45 New Windows Options in 3. 3 PATH, Launcher 46 Where to Run: Code directories 47 What Not to Type: Prompts and Comments 48 Running Code interactively 49 Why the Interactive Prompt 50 Usage Notes: The Interactive Prompt 52 System Command Lines and Files 54 A First Script Running files with Command lines 56 Command-Line Usage variations 57 Usage Notes: Command Lines and files 58 Unix-Style Executable Scripts: # Unix Script Basics The Unix env Lookup Trick 60 The Python 3. 3 Windows Launcher:#! Comes to Windows 60 Clicking file icons 62 Icon-Click Basics 62 Clicking Icons on Windows 63 The input Trick on Windows 63 Other Icon -Click limitations 66 vi Table of Contents Module imports and reloads Import and reload basics The grander Module story: Attributes 68 Usage Notes: import and reload 71 Using exec to Run Module files The IDLE User Interface IDLE Startup detai 74 IDLE Basic Usage 75 IDLE USability Features Advanced idle tools Usage Notes: IDLE Other IDes Other Launch options 81 Embedding calls Frozen Binary Executables 82 Text Editor Launch Options Still Other Launch options 82 Future Possibilities? Which Option Should I Use? Chapter summary 85 Test Your Knowledge: Quiz 85 Test Your Knowledge: Answers Test Your Knowledge Part I Exercises Part l. types and Operations 4. Introducing Python Object Types.............,.,...... 93 The Python Conceptual Hierarchy 93 Why Use Built-in Types 94 Python's Core Data Types umbers ing 99 Sequence operations 99 Immutability 101 Type-Specific Methods Getting Help 104 Other Ways to Code Strings 105 Unicode Strings 106 Pattern Matching 108 Ists 109 Sequence operations 109 pe-Specitic operations 109 Table of contents|ⅶi Bounds Checking 110 Nesting 110 C comprehensions 111 Dictionaries 113 Mapping Operations 114 Nesting Revisited 115 Missing Keys: if Tests 116 Sorting Keys: for Loops 118 Iteration and Optimization 120 Why Tuples? file Binary Bytes file Unicode Text files Other File-Like tools 2222222 1223466 Other Core Types How to Break Your Code's Flexibility 128 User-Defined Classes 129 And Everything Else 130 Chapter summary 130 est Your Knowledge: Quiz 131 Test Your Knowledge: Answers 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 Bi ltwise operations 153 Other Built-in Numeric tools 155 Other Numeric Types 157 IT 157 Fraction l ype 160 163 Booleans 171 ⅶ iiI Table of Contents

...展开详情
立即下载
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
关注 私信
上传资源赚钱or赚积分
最新推荐
Learning Python 5th edition 9积分/C币 立即下载
1/0