This book is the first book about Python language in China. Python is a very powerful object-oriented programming language that can be used to write stand-alone programs, quick scripts, and prototypes of complex applications. As an open source software, Python is freely available and very easy to learn and use. It has been ported on a variety of platforms, including various Unix systems, Linux, Windows 9x, Windows NT and MacOS.
After taking the Unix and Linux worlds by storm, Python has become the new favorite for Windows programmers to create scripts because of its simple interface with the Windows Application Object Model. The emergence of JPython has made Python a powerful tool in the Java programming environment.
This book is a classic introductory book on the Python language. It is jointly written by two top Python technical experts and training experts and covers all the core content of the language. Each chapter in the book contains numerous examples and is accompanied by carefully compiled exercises. Because Python runs interactively like Basic, readers can run these examples and exercises on any system that has Python installed. Solutions to all exercises can be found at the back of the book.
This book describes the basic building blocks of Python programs: types, operators, statements, functions, modules, classes, and exceptions. In addition, the book covers more advanced topics, including complex examples. Finally, it also describes how to use Python custom libraries to create large programs, including a utility program written in JPython.
Whether used for writing simple scripts or complex scientific computing, web, database, graphics and animation programs, Python has proven to be a powerful and convenient tool. With this book in hand, you can learn to use this (currently hottest in the world) language quickly and efficiently.
"A flexible scripting language like Python is an indispensable tool in Industrial Light&Magic."
--Tommy Burnette
Technical Director
Industrial Light & Magic Company (Computer special effects design company for the movie "Jurassic Park")
Chapter table of contents
Preface Part 1 Language Core Chapter 1 Starting Why Choose Python?
How to run a Python program?
A first look at module files
Python Setting Details Summary Exercise Chapter 2 Types and Operators
Why does Python program structure use built-in types?
Numeric String List Dictionary Tuple File Common Object Properties Built-in Type FAQ Summary Exercise Chapter 3 Basic Statement Assignment Expressions
print
if condition test
while loop
Summary of Common Problems in For Loop Code Writing Exercises Chapter 4 Functions Why use functions?
Function Scope Rules in Basic Functions Parameter Passing Other Contents FAQ Summary of Functions Exercise Chapter 5 Modules Why use modules?
Module base module file is the namespace import mode overload module other content module FAQ summary exercise Chapter 6 classes why to use the basic knowledge of classes use the class statement use the class method inheritance search the namespace tree overload operations in the class Summary of character namespace rules Using classes to design other content Common problems with classes Summary of exercises Chapter 7 Exceptions Why use exceptions Basic knowledge of exceptions Idioms of exceptions Exception capture patterns Other content Common problems with exceptions Summary of exercises Part 2 Peripheral layer Chapter 2 Chapter 8 Built-in Tools Built-in Function Library Module Exercises Chapter 9 Use Python to Complete Common Tasks Data Structure Operations File Operations Operation Programs Internet-related Tasks Larger Example Exercises Chapter 10 Framework and Application Automation Customer Support System and COM Interface: Cheap Public Relations Design Considerations of an Editor Based on Tkinter for Managing Tabular Data
JPython: Combining Python and Java Other Frameworks and Applications Exercises Part Three Appendix Appendix One Python Resources Appendix Two Platform-Specific Questions Appendix Three Exercise Solutions Glossary
Expand