副标题:无

作   者:

分类号:

ISBN:9781430216339

微信扫一扫,移动浏览光盘

简介

There are many more people who want to study programming other than aspiring computer scientists with a passing grade in advanced calculus. This guide appeals to your intelligence and ability to solve practical problems, while gently teaching the most recent revision of the programming language Python. You can learn solid software design skills and accomplish practical programming tasks, like extending applications and automating everyday processes, even if you have no programming experience at all. Authors Tim Hall and J-P Stacey use everyday languageto decode programming jargon and teach Py

目录

Title Page 1
Copyright Page 2
Contents at a Glance 3
Table of Contents 4
About the Author 8
About the Technical Reviewer 9
Chapter 1: Introducing Python 10
Running Python on Various Systems 10
Installing on Windows 11
Installing on Other Systems 11
Choosing the Right Python Version 11
Understanding the Jargon 12
Learning While Having Fun 13
Introducing the Interactive Shell 13
Choosing to Code with a Text Editor 14
Choosing to Code with an Integrated Development Environment 14
Getting Started with Programming 14
Creating Your Own Help Files 15
Jargon Busting 15
Summary 16
Chapter 2: Designing Software 17
Designing Your Own Software (Why Bother?) 17
Asking the Right Questions 18
Using Python to Solve Problems 18
Identifying the Problem 18
What Do You Want the Software to Do? 19
Who Will Be Using It? 19
What System Will Users Be Running It On? 20
Creating Your Wish List 20
Talking to Potential Users 20
Watching Users Perform the Task at Hand 21
Compiling User Stories 21
Devising a Solution 21
Understanding the Problem 21
Knowing What the Software Needs to Do 22
Considering Other Needs or Limitations 22
Defining Acceptable Results 22
Considering Maintenance 22
Breaking Down the Solution into Steps 23
Organizing the Tasks into Steps 24
Using Indentation and Subgroups 25
Refining Each Line of Your Pseudocode Until a Solution Is Reached 25
Coding the Design 26
Turning the Design into Executable Code 26
Further Refining the Design 27
Using functions 27
Testing the Design 28
Detecting and correcting coding errors 29
Noting Modifications, Extensions, and Enhancements 30
Documenting the Solution 30
Jargon Busting 32
Summary 33
Chapter 3: Variables and Data Types 34
Choosing Good Identifiers 34
Python Keywords 34
Following the Naming Rules 35
Creating Variables and Assigning Values 35
Recognizing Different Types of Variables 36
Working with Dynamic Typing 36
In the Beginning Was the Void 38
Joining Up Text Fragments 38
Using Quotes 39
Nesting Quotes 40
Escaping Sequences 41
Using Special Whitespace Characters 41
The More Strings Change the More They Stay the Same 42
Creating a Text Application 42
Working with Numbers 44
Using Binary: Computers Can Only Count to One 44
Bits and Bytes 44
Using Booleans: Truth or Dare 44
Using Whole Numbers (Integers) 45
Performing Basic Mathematical Operations 45
Understanding Operator Precedence 46
Dividing Numbers 46
Working with Fractions and Floats 47
Converting One Type into Another 47
Working with Base 8 (Octal) and Base 16 (Hexadecimal) 48
Creating a Number Application 50
Jargon Busting 52
Summary 54
Chapter 4: Making Choices 55
Comparing Things 55
Manipulating Boolean Values 58
Combining Conditional Expressions 59
Using Assignment Operators 59
Understanding Operator Precedence 60
Taking Control of the Process 61
Using the for Statement 75
Dealing with Logical Errors 63
Using Conditional Code in the Application 67
Now Repeat That 71
Looping with the while Statement 71
Now Get Out of That 73
Nesting Conditional Statements 75
Jargon Busting 79
Summary 80
Chapter 5: Using Lists 81
Working with Python Data Structures 81
Accessing the items in a sequence 81
If You\u2019re Not on the List, You Can\u2019t Come In 83
Tuples 85
Creating a Tuple 85
Changing the Values in a Tuple 86
Lists 86
Creating a List 86
Modifying a List 86
Stacks and Queues 88
Sorting Lists 88
Multidimensional Lists 89
Processing Large Amounts of Data Easily 89
List Comprehensions 90
Sets 91
Dictionaries 92
Defining Dictionaries 92
Deleting Items 94
Sorting Dictionaries 95
Using Dictionaries 95
A Simple Role-Playing Combat Game 95
Jargon Busting 105
Summary 106
Chapter 6: Functions 107
Accessing Privileged Information 107
Defining Functions 107
Sending Out Invitations 108
Passing an Unknown Number of Values into the Function 109
Using docstrings to Document Your Function 110
Working with Variable Scope 111
Understanding Scope 111
Using the global Statement 113
Manipulating Lists and Dictionaries 114
Refactoring rpcombat.py to Reduce Repetition 114
Cutting Out the Waffle 115
Keeping Your Code Readable 117
The Matrix Refactored 119
Jargon Busting 129
Summary 130
Chapter 7: Working with Text 131
Strings and Things 131
Splitting Strings 132
Joining Strings, or Avoiding Concatenation 133
Changing Case 134
Simple Methods of Formatting 135
Advanced Formatting 135
Format Specification 136
Editing Strings 140
Finding Strings 140
Matching Patterns Using Regular Expressions 141
Matching Subpatterns 143
Matching Character Sets and Alternatives 144
Finding Patterns at the Beginning or End of a String 144
Creating a Regular Expression Object 145
Letting the Characters Escape 145
Manipulating Strings Using Regular Expressions 145
Using Files 147
Opening Files 147
Modes and Buffers 148
Reading from and Writing to Files 148
Finding Your Way Around Files 149
Closing Files 150
Applications 151
Converting Text 151
Story 153
Checking and Correcting Styles 153
Formatting Data 160
Storing Data 162
Jargon Busting 165
Summary 166
Chapter 8: Executable Files, Organization, and Python on the Web 167
Making Programs Executable as Stand-Alone Applications 167
Organizing Your Project 170
Writing Stylish Code 171
Becoming More Pythonic 172
Importing Modules 176
Using exec() and eval() 178
Putting Python on the Web 179
Creating a Quick CGI Form 183
Jargon Busting 185
Summary 185
Chapter 9: Classes 186
Empowering objects 187
Defining Classes 187
Who Is self? 188
Determining an Object\u2019s Type 189
Namespaces and Why We Need Them 190
When Should Classes Be Used? 190
Parents and Children\u2014Inheritance 194
Using Methods 195
Customizing Classes 196
Constructors 197
Customizing Output 198
Emulating Existing Types 199
Properties 201
Customizing Attribute Access 202
Emulating Numeric Types 202
Application 205
Jargon Busting 224
Summary 225
Chapter 10: Exceptions 226
When Something Goes Wrong 226
Handling Simple Exceptions 227
Using the try Statement with an except Clause in Python 227
Classes of Exceptions 229
Exception objects and the hierarchy of classes 229
Creating and Raising an Exception Object 230
Creating Your Own Exception Classes 232
Accessing Properties of the Raised Exception 234
Implementing Complex Error Handling 236
Using finally to Clean Up After a Problem 236
Putting Everything Together with else 237
Using the Traceback If All Else Fails 239
Exception Chaining and Tracebacks 240
A Final Note on Pythonic Exception Handling 243
Jargon Busting 244
Summary 245
Chapter 11: Reusing Code with Modules and Packages 246
Understanding Python Modules 246
Creating Your First Module 247
Using Your Module in Another Program 248
Everyday Module Usage 249
Flexible Importing 249
Structuring Your Modules 251
Advanced Module Behavior 254
Reloading Module Changes Dynamically 254
Python Module Internals 255
Combining Modules into Packages 257
Understanding Packages 257
Building a Pirate-Speak Package 257
The Universe of Python packages 259
Standard Modules 259
Installing Contributed Packages 259
Three Examples from the Python Universe 261
csv 261
datetime 262
Beautiful Soup and urllib 263
A Package for Everything\u2014Eventually 264
Jargon Busting 264
Summary 265
Chapter 12: Simple Windowed Applications 266
Using Tkinter 266
Saying \u201cHello\u201d with PyGTK 270
Catching Signals 272
Building Complex Interfaces 273
Creating the GUI 274
Making the Commands Do Something Useful 277
Using Glade and tepache to Build Interfaces 284
Jargon Busting 287
Summary 287
Index 288

已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    loading icon