Python编程 从入门到实践
作者:[美]埃里克·马瑟斯(Eric Matthes) 译者:袁国忠

文章目录
第1章 起步
介绍在计算机中安装 Python,并运行第一个程序——在屏幕上打印消息"Hello world!"。
- 终端方式
- 文本编辑器方式
第2章 变量和简单数据类型
论述如何在变量中存储信息以及如何使用文本和数字。
命名规则
- 变量名只能包含字母、数字和下划线,以字母或下划线开头
- 注意保留字
字符串的一些方法
-
title() 首字母大写
-
upper() 全部大写
-
lower() 全部小写
-
加号 拼接字符串
-
strip() 删除两端的空白
-
lstrip() 删除开头的空白
-
rstrip() 删除结尾的空白
python >>> import this
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Un

本书介绍了Python编程的基础,包括起步、变量和简单数据类型、列表的操作。第1章讲解如何安装Python并运行第一个程序。第2章探讨变量的使用,如命名规则和字符串方法。第3、4章深入列表,涉及列表的定义、修改、添加、删除元素,以及排序、遍历、切片和元组的概念。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



