Beginning Python: Using Python 2.6 and Python 3.1 introduces this open source, portable, interpreted, object-oriented programming language that combines remarkable power with clear syntax. This book enables you to quickly create robust, reliable, and reusable Python applications by teaching the basics so you can quickly develop Web and scientific applications, incorporate databases, and master systems tasks on various operating systems, including Linux, MAC OS, and Windows. You'll get a comprehensive tutorial that guides you from writing simple, basic Python scripts all the way through complex concepts, and also features a reference of the standard modules with examples illustrating how to implement features in the various modules. Plus, the book covers using Python in specific program development domains, such as XML, databases, scientific applications, network programming, and Web development.
Autorentext
James Payne is Editor in Chief of www.developershed.com, a network of high-technology sites that serves millions of unique visitors every month who are seeking tutorials, advice, answers, or articles.
Klappentext
Create a robust, reliable, and reusable Python application
As an open source, object-oriented programming language, Python is easy to understand, extendable, and user-friendly. This book covers every aspect of Python so that you can get started writing your own programs with Python today. Author James Payne begins with the most basic concepts of the Python languageplacing a special focus on the 2.6 and 3.1 versionsand he offers an in-depth look at existing Python programs so you can learn by example. Topics progress from strings, lists, and dictionaries to classes, objects, and modules. With this book, you will learn how to quickly and confidently create a robust, reliable, and reusable Python application.
Beginning Python:
-
Introduces the concepts of variables for storing and manipulating data
-
Examines files and input/output for reading or writing data
-
Reviews examples of often-overlooked features of Python
-
Delves into writing tests for modules and programs
-
Addresses programming with a graphical user interface in Python
-
Places special focus on XML, HTML, XSL, and related technologies
-
Explains how to extend Python
-
Shares numerical programming techniques
-
Offers an inside look at Jython, a version of Python written in Java
Programmer Forums
Join our Programmer to Programmer forums to ask and answer programming questions about this book, join discussions on the hottest topics in the industry, and connect with fellow programmers from around the world.
Code Downloads
Take advantage of free code samples from this book, as well as code samples from hundreds of other books, all ready to use.
Read More
Find articles, ebooks, sample chapters and tables of contents for hundreds of books, and more reference resources on programming topics that matter to you.
Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
wrox.com
Zusammenfassung
Beginning Python: Using Python 2.6 and Python 3.1 introduces this open source, portable, interpreted, object-oriented programming language that combines remarkable power with clear syntax. This book enables you to quickly create robust, reliable, and reusable Python applications by teaching the basics so you can quickly develop Web and scientific applications, incorporate databases, and master systems tasks on various operating systems, including Linux, MAC OS, and Windows. You'll get a comprehensive tutorial that guides you from writing simple, basic Python scripts all the way through complex concepts, and also features a reference of the standard modules with examples illustrating how to implement features in the various modules. Plus, the book covers using Python in specific program development domains, such as XML, databases, scientific applications, network programming, and Web development.
Inhalt
Introduction xxvii
Part I: Dipping Your Toe into Python 1
Chapter 1: Programming Basics and Strings 3
How Programming is Different from Using a Computer 3
The First Steps 5
Beginning to Use Python Strings 7
Putting Two Strings Together 11
Putting Strings Together in Different Ways 12
Summary 13
Exercises 14
Chapter 2: Numbers and Operators 15
Different Kinds of Numbers 15
Program Files 18
Using Numbers 24
Summary 28
Exercises 29
Chapter 3: Variables Names for Values 31
Referring to Data Using Names for Data 31
Using More Built-in Types 34
Other Common Sequence Properties 43
Summary 47
Exercises 48
Part II: Python Language and the Standard Library 49
Chapter 4: Making Decisions 51
Comparing Values Are They the Same? 51
Doing the Opposite Not Equal 53
Comparing Values Which One Is More? 54
Reversing True and False 56
Looking for the Results of More Than One Comparison 56
Repetition 60
Handling Errors 65
Summary 67
Exercises 69
Chapter 5: Functions 71
Putting Your Program into Its Own File 71
Functions: Grouping Code under a Name 73
Layers of Functions 88
Summary 89
Exercises 90
Chapter 6: Classes and Objects 93
Thinking About Programming 93
Defining a Class 96
Summary 107
Exercises 108
Chapter 7: Organizing Programs 111
Modules 112
Packages 118
Modules and Packages 120
Basics of Testing Your Modules and Packages 124
Summary 124
Exercises 125
Chapter 8: Files and Directories 127
File Objects 127
Paths and Directories 131
Exceptions in os 132
Summary 142
Exercises 142
Chapter 9: Other Features of the Language 143
Lambda and Filter: Short Anonymous Functions 143
Map: Short-Circuiting Loops 144
Decisions within Lists List Comprehension 145
Generating Iterators for Loops 146
Special String Substitution Using Dictionaries 148
Featured Modules 149
Summary 156
Exercises 156
Chapter 10: Building a Module 157
Exploring Modules 157
Creating Modules and Packages 162
Working with Classes 163
Finishing Your Modules 166
Creating a Whole Module 179
Installing Your Modules 183
Summary 187
Exercises 188
Chapter 11: Text Processing 189
Why Text Processing Is So Useful 189
Navigating the File System with the os Module 192
Working with Regular Expressions and the re Module 199
Summary 203
Exercises 204
Part III: Putting Python to Work 205
Chapter 12: Testing 207
Assertions 208
Test Cases and Test Suites 209
Test Fixtures 213
Putting It All Together with Extreme Programming 216
Formal Testing in the Software Life Cycle 224
Summary 225
Chapter 13: Writing a GUI with Python 227
GUI Programming Toolkits for Python 228
Tkinter Introduction 229
Creating GUI Widgets with Tkinter 229
Summary 238
Exercises 238
Chapter 14: Accessing Databases 239
Working with DBM Persistent Dictionaries 240
Working with Relational Databases…