Home Backend Development Python Tutorial 简明 Python 基础学习教程

简明 Python 基础学习教程

Jun 06, 2016 am 11:26 AM
python

版本:1.20

A Byte of Python
Copyright © 2003-2005 Swaroop C H
简明 Python 教程
《简明 Python 教程》为 "A Byte of Python" 的唯一指定简体中文译本,版权 © 2005 沈洁元

本书依照 创作公用约定(署名-非派生作品-非商业用途) 发布。

概要

无论您刚接触电脑还是一个有经验的程序员,本书都将有助您学习使用Python语言。



前言
本书的读者
本书的由来
本书目前的状况
官方网站
约定条款
欢迎给我反馈
值得思考的一些东西
1. 介绍
简介
Python的特色
     概括
为什么不使用Perl?
程序员的话
2. 安装Python
Linux和BSD用户
Windows®用户
概括
3. 最初的步骤
简介
使用带提示符的解释器
挑选一个编辑器
使用源文件
     输出
     它如何工作
可执行的Python程序
获取帮助
概括
4. 基本概念
字面意义上的常量
字符串
变量
标识符的命名
数据类型
对象
     输出
     它如何工作
逻辑行与物理行
缩进
概括
5. 运算符与表达式
简介
运算符
运算符优先级
     计算顺序
     结合规律
表达式
     使用表达式
概括
6. 控制流
简介
if语句
     使用if语句
     它如何工作
while语句
     使用while语句
for循环
     使用for语句
break语句
     使用break语句
continue语句
     使用continue语句
概括
7. 函数
简介
     定义函数
函数形参
     使用函数形参
局部变量
     使用局部变量
     使用global语句
默认参数值
     使用默认参数值
关键参数
     使用关键参数
return语句
     使用字面意义上的语句
DocStrings
     使用DocStrings
概括
8. 模块
简介
     使用sys模块
字节编译的.pyc文件
from..import语句
模块的__name__
     使用模块的__name__
制造你自己的模块
     创建你自己的模块
     from..import
dir()函数
     使用dir函数
概括
9. 数据结构
简介
列表
     对象与类的快速入门
     使用列表
元组
     使用元组
     元组与打印语句
字典
     使用字典
序列
     使用序列
参考
     对象与参考
更多字符串的内容
     字符串的方法
概括
10. 解决问题——编写一个Python脚本
问题
解决方案
     版本一
     版本二
     版本三
     版本四
     进一步优化
软件开发过程
概括
11. 面向对象的编程
简介
self
     创建一个类
对象的方法
     使用对象的方法
__init__方法
     使用__init__方法
类与对象的变量
     使用类与对象的变量
继承
     使用继承
概括
12. 输入/输出
文件
     使用文件
储存器
     储存与取储存
概括
13. 异常
错误
try..except
     处理异常
引发异常
     如何引发异常
try..finally
     使用finally
概括
14. Python标准库
简介
sys模块
     命令行参数
     更多sys的内容
os模块
概括
15. 更多Python的内容
特殊的方法
单语句块
列表综合
     使用列表综合
在函数中接收元组和列表
lambda形式
     使用lambda形式
exec和eval语句
assert语句
repr函数
概括
16. 接下来学习什么?
图形软件
     GUI工具概括
探索更多内容
概括
A. 自由/开放源码软件(FLOSS)
B. 关于本书
后记
关于作者
关于译者
关于简体中文译本
C. 修订记录
时间表
术语表

表格

5.1 运算符与它们的用法
5.2 运算符优先级
15.1 一些特殊的方法

例子

3.1 使用带提示符的Python解释器
3.2 使用源文件
4.1 使用变量和字面意义上的常量
5.1 使用表达式
6.1 使用if语句
6.2 使用while语句
6.3 使用for语句
6.4 使用break语句
6.5 使用continue语句
7.1 定义函数
7.2 使用函数形参
7.3 使用局部变量
7.4 使用global语句
7.5 使用默认参数值
7.6 使用关键参数
7.7 使用字面意义上的语句
7.8 使用DocStrings
8.1 使用sys模块
8.2 使用模块的__name__
8.3 如何创建你自己的模块
8.4 使用dir函数
9.1 使用列表
9.2 使用元组
9.3 使用元组输出
9.4 使用字典
9.5 使用序列
9.6 对象与参考
10.1 备份脚本——版本一
10.2 备份脚本——版本二
10.3 备份脚本——版本三(不工作!)
10.4 备份脚本——版本四
11.1 创建一个类
11.2 使用对象的方法
11.3 使用__init__方法
11.4 使用类与对象的变量
11.5 使用继承
12.1 使用文件
12.2 储存与取储存
13.1 处理异常
13.2 如何引发异常
14.1 使用sys.argv
15.1 使用列表综合
15.2 使用lambda形式
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

How to solve the problem of Pylance type detection of custom decorators in Python? How to solve the problem of Pylance type detection of custom decorators in Python? Apr 02, 2025 am 06:42 AM

Pylance type detection problem solution when using custom decorator In Python programming, decorator is a powerful tool that can be used to add rows...

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

Python 3.6 loading pickle file error ModuleNotFoundError: What should I do if I load pickle file '__builtin__'? Python 3.6 loading pickle file error ModuleNotFoundError: What should I do if I load pickle file '__builtin__'? Apr 02, 2025 am 06:27 AM

Loading pickle file in Python 3.6 environment error: ModuleNotFoundError:Nomodulenamed...

Do FastAPI and aiohttp share the same global event loop? Do FastAPI and aiohttp share the same global event loop? Apr 02, 2025 am 06:12 AM

Compatibility issues between Python asynchronous libraries In Python, asynchronous programming has become the process of high concurrency and I/O...

What should I do if the '__builtin__' module is not found when loading the Pickle file in Python 3.6? What should I do if the '__builtin__' module is not found when loading the Pickle file in Python 3.6? Apr 02, 2025 am 07:12 AM

Error loading Pickle file in Python 3.6 environment: ModuleNotFoundError:Nomodulenamed...

How to ensure that the child process also terminates after killing the parent process via signal in Python? How to ensure that the child process also terminates after killing the parent process via signal in Python? Apr 02, 2025 am 06:39 AM

The problem and solution of the child process continuing to run when using signals to kill the parent process. In Python programming, after killing the parent process through signals, the child process still...

See all articles