没有合适的资源?快使用搜索试试~ 我知道了~
Python是一种解释型、面向对象、动态数据类型的高级程序设计语言。 Python由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年。 像Perl语言一样, Python 源代码同样遵循 GPL(GNU General Public License)协议。 本教程主要针对Python 2.x版本的学习,如果你使用的是Python 3.x版本请移步至Python 3.X版本的教程。
资源推荐
资源详情
资源评论
A Byte of Python
Swaroop C H
A Byte of Python
Swaroop C H
Copyright © 2003-2005 Swaroop C H
Abstract
This book will help you to learn the Python programming language, whether you are new to computers
or are an experienced programmer.
This book is released under the Creative Commons Attribution-NonCommercial-ShareAlike License 2.0 .
Table of Contents
Preface ...................................................................................................................... x
Who This Book Is For ..........................................................................................x
History Lesson ................................................................................................... x
Status of the book ................................................................................................x
Official Website ................................................................................................. xi
License Terms ................................................................................................... xi
Feedback .......................................................................................................... xi
Something To Think About .................................................................................. xi
1. Introduction ............................................................................................................1
Introduction .......................................................................................................1
Features of Python ..............................................................................................1
Summary ...................................................................................................2
Why not Perl? .................................................................................................... 3
What Programmers Say ........................................................................................3
2. Installing Python .....................................................................................................4
For Linux/BSD users ........................................................................................... 4
For Windows Users .............................................................................................4
Summary ........................................................................................................... 5
3. First Steps .............................................................................................................. 6
Introduction .......................................................................................................6
Using the interpreter prompt ..................................................................................6
Choosing an Editor ..............................................................................................6
Using a Source File ............................................................................................. 7
Output ......................................................................................................7
How It Works .............................................................................................8
Executable Python programs .................................................................................8
Getting Help ......................................................................................................9
Summary ......................................................................................................... 10
4. The Basics ............................................................................................................ 11
Literal Constants ............................................................................................... 11
Numbers ......................................................................................................... 11
Strings ............................................................................................................ 11
Variables ......................................................................................................... 13
Identifier Naming .............................................................................................. 13
Data Types ...................................................................................................... 14
Objects ........................................................................................................... 14
Output .................................................................................................... 15
How It Works ........................................................................................... 15
Logical and Physical Lines ................................................................................. 15
Indentation ...................................................................................................... 17
Summary ......................................................................................................... 18
5. Operators and Expressions ....................................................................................... 19
Introduction ..................................................................................................... 19
Operators ......................................................................................................... 19
Operator Precedence .......................................................................................... 21
Order of Evaluation ................................................................................... 22
Associativity ............................................................................................ 22
Expressions ...................................................................................................... 22
Using Expressions ..................................................................................... 22
Summary ......................................................................................................... 23
6. Control Flow ........................................................................................................ 24
Introduction ..................................................................................................... 24
The if statement ................................................................................................ 24
iv
Using the if statement ................................................................................ 24
How It Works ........................................................................................... 25
The while statement ........................................................................................... 26
Using the while statement ........................................................................... 26
The for loop ..................................................................................................... 27
Using the for statement .............................................................................. 27
The break statement ........................................................................................... 28
Using the break statement ........................................................................... 28
The continue statement ....................................................................................... 30
Using the continue statement ....................................................................... 30
Summary ......................................................................................................... 30
7. Functions ............................................................................................................. 32
Introduction ..................................................................................................... 32
Defining a Function ................................................................................... 32
Function Parameters .......................................................................................... 32
Using Function Parameters ......................................................................... 33
Local Variables ................................................................................................ 33
Using Local Variables ................................................................................ 34
Using the global statement .......................................................................... 34
Default Argument Values ................................................................................... 35
Using Default Argument Values .................................................................. 35
Keyword Arguments .......................................................................................... 36
Using Keyword Arguments ......................................................................... 37
The return statement .......................................................................................... 37
Using the literal statement ........................................................................... 38
DocStrings ....................................................................................................... 38
Using DocStrings ...................................................................................... 39
Summary ......................................................................................................... 40
8. Modules ............................................................................................................... 41
Introduction ..................................................................................................... 41
Using the sys module ................................................................................. 41
Byte-compiled .pyc files ..................................................................................... 42
The from..import statement ................................................................................. 42
A module's __name__ ........................................................................................ 42
Using a module's __name__ ........................................................................ 43
Making your own Modules ................................................................................. 43
Creating your own Modules ........................................................................ 43
from..import ............................................................................................. 44
The dir() function .............................................................................................. 45
Using the dir function ................................................................................ 45
Summary ......................................................................................................... 46
9. Data Structures ...................................................................................................... 47
Introduction ..................................................................................................... 47
List ................................................................................................................ 47
Quick introduction to Objects and Classes ..................................................... 47
Using Lists .............................................................................................. 47
Tuple .............................................................................................................. 49
Using Tuples ............................................................................................ 49
Tuples and the print statement ..................................................................... 50
Dictionary ....................................................................................................... 51
Using Dictionaries ..................................................................................... 51
Sequences ........................................................................................................ 53
Using Sequences ....................................................................................... 53
References ....................................................................................................... 54
Objects and References .............................................................................. 55
More about Strings ............................................................................................ 56
String Methods ......................................................................................... 56
Summary ......................................................................................................... 57
A Byte of Python
v
剩余109页未读,继续阅读
资源评论
Bulijiujiuduobulituo
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C#ASP.NET多用户微信商城分销直销平台源码数据库 SQL2008源码类型 WebForm
- (源码)基于Spring Cloud Alibaba的微服务管理系统.zip
- (源码)基于C#的电动车销售管理系统.zip
- (源码)基于Spring Boot和Vue的博客管理系统.zip
- (源码)基于快应用框架的轻量级应用管理系统.zip
- (源码)基于QT的景点管理系统.zip
- (源码)基于Spring Boot和Vue的博客系统.zip
- C#ASP.NET仓储管理系统源码数据库 SQL2008源码类型 WebForm
- (源码)基于Spring Boot和MyBatis的飞机订票系统.zip
- (源码)基于Qt和RibbonUI的密钥管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功