Simple Python Basics

Source: Internet
Author: User

Version: 1.20

A Byte of Python
Copyright©2003-2005 Swaroop C H
Concise Python tutorial
The concise Python tutorial is the only designated Simplified Chinese Translation of "A Byte of Python ".©2005 Shen jieyuan

AccordingCreate a public agreement (signature-non-derivative work-non-commercial use)Release.

Summary

Whether you are new to a computer or an experienced programmer, this book will help you learn how to use Python.


Preface
Readers of this book
The origins of this book
Current Situation of this book
Official Website
Terms
Thank you for your feedback.
Something worth thinking about
1. Introduction
Introduction
Python features
Summary
Why not use Perl?
For programmers
2. Install Python
Linux and BSD users
Windows®User
Summary
3. Initial steps
Introduction
Use an interpreter with a prompt
Select an editor
Use source files
Output
How it works
Executable Python Program
Get help
Summary
4. Basic Concepts
Literal Constants
Quantity
String
Variable
Identifier name
Data Type
Object
Output
How it works
Logical and physical rows
Indent
Summary
5. Operators and expressions
Introduction
Operator
Operator priority
Computing Sequence
Combination rules
Expression
Use expressions
Summary
6. Control Flow
Introduction
If statement
Use the if statement
How it works
While statement
Use the while statement
For Loop
Use the for statement
Break statement
Use the break statement
Continue statement
Use the continue statement
Summary
7. Functions
Introduction
Define functions
Function Parameters
Use Function Parameters
Local variable
Use local variables
Use global statements
Default parameter value
Use default parameter values
Key parameters
Use Key Parameters
Return Statement
Use literal statements
DocStrings
Use DocStrings
Summary
8. Module
Introduction
Use sys module
Byte-compiled. pyc File
From .. import Statement
Module _ name __
Use the _ name _ of the module __
Create your own modules
Create your own module
From .. import
Dir () function
Use the dir Function
Summary
9. Data Structure
Introduction
List
Quick Start to objects and Classes
Usage list
Tuples
Use tuples
Tuples and print statements
Dictionary
Use dictionaries
Sequence
Use Sequence
Reference
Objects and references
More string content
String Method
Summary
10. Solve the Problem-write a Python script
Problem
Solution
Version 1
Version 2
Version 3
Version 4
Further Optimization
Software Development Process
Summary
11. Object-Oriented Programming
Introduction
Self
Class
Create a class
Object Method
Object Method
_ Init _ Method
Use the _ init _ Method
Class and object variables
Use variables of classes and objects
Inheritance
Use inheritance
Summary
12. Input/Output
File
Use Files
Storage
Storage and retrieval
Summary
13. Exception
Error
Try... try t
Exception Handling
Exception
How to Raise exceptions
Try .. finally
Use finally
Summary
14. Python standard library
Introduction
Sys module
Command Line Parameters
More information about sys
OS Module
Summary
15. More Python content
Special Method
Single statement Block
Comprehensive List
Comprehensive use list
Receiving tuples and lists in Functions
Lambda form
Use lambda
Exec and eval statements
Assert statement
Repr Function
Summary
16. What to learn next?
Graphics Software
GUI tool Overview
Explore more
Summary
A. Free/open source software (FLOSS)
B. About this book
Postscript
About the author
About translators
Simplified Chinese Translation
C. Revision history
Schedule
Glossary

Table

5.1 operators and their usage
5.2 operator priority
15.1 some special methods

Example

3.1 Use the Python interpreter with a prompt
3.2 use source files
4.1 Use variables and constants in the Word Sense
5.1 use expressions
6.1 use the if statement
6.2 use the while statement
6.3 use the for statement
6.4 Use the break statement
6.5 use the continue statement
7.1 define functions
7.2 use function parameters
7.3 use local variables
7.4 use global statements
7.5 use the default parameter value
7.6 use key parameters
7.7 use literal statements
7.8 use DocStrings
8.1 use sys module
8.2 use the _ name _ of the module __
8.3 how to create your own modules
8.4 use the dir Function
9.1 usage list
9.2 use tuples
9.3 Output Using tuples
9.4 use a dictionary
9.5 use sequence
9.6 objects and references
10.1 backup script-Version 1
10.2 backup script-Version 2
10.3 backup script-Version 3 (not working !)
10.4 backup script-version 4
11.1 create a class
11.2 method of using objects
11.3 use the _ init _ Method
11.4 use variables of classes and objects
11.5 use inheritance
12.1 Use Files
12.2 storage and retrieval
13.1 handling exceptions
13.2 how to cause exceptions
14.1 use sys. argv
15.1 comprehensive use list
15.2 use lambda

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.