Python
1. print
- 在 Python 2 和 Python 3 中print是有区别
- Python 2
print hello,world
- Python 3
print (hello,world)
2.input
3.命名规则
- 字母表中的字母(大写或小写,Python支持大小写)
- 开头不能是数字
- 同一行多条语句用,用分号;分开
- 不能是Python的关键字(查看关键字输入import keyword就可以观看)
3.Python变量特性
- 变量在使用前必须定义,否则报错
- 能赋值多个变量
4.Python注释方法
- 单行注释以 # 开头
- 多行注释以三个单引号 ‘’’ 文字内容 ‘’’ 或者三个双引号 “”" 文字内容 “”"
5.Python中冒号“ :”作用
- 代码层次分明
- 默认全部选择
- 指定范围
6.Python中的dir()函数
- dir() 函数不带参数时,返回当前范围内的变量、方法和定义的类型列表;带参数时,返回参数的属性、方法列表
参考链接:https://www.runoob.com/python/python-func-dir.html
参考链接:https://www.iplaypy.com/jichu/dir.html
7.Python中的help()函数
- 查看Python模块中的函数的用法
8.Python import
- 一个模块不会重复载入
2.一旦import,模块将会导入内存中,属于绝对导入 - import只能导入模块,不能导入模块中的对象(类、函数、变量等)
参考链接:http://blog.sina.com.cn/s/blog_90bc5fc6010159e0.html
9.Python PEP8编码规范中文版
参考链接:https://blog.csdn.net/ratsniper/article/details/78954852
参考链接:https://blog.csdn.net/kellyseeme/article/details/50644893
10.Python数值类型
- 整数(int)
- 浮点数(float)
- 布尔值(bool)
- 字符串(string)
- 空值(none)
- 列表(list)
- 元组(tuple)
- 字典(dictionary)
- 集合(set)
参考链接:https://blog.csdn.net/mdxiaohu/article/details/81508650
https://www.runoob.com/python3/python3-data-type.html
11.运算符
- 算术运算符
- 加(+)、减(-)、乘(*)、除(/)
- 幂运算(**)、取余数(%)
- 注意的是取整除(//)——向下取接近的除数的整数
- 逻辑运算符
- and
- or
- not
- 成员运算符
- 是身份运算符
- is
- is not
- is 与 == 区别
is用于判断俩个变量引用对象是否为同一个,== 用于判断引用变量的值是否相等
- 运算优先级
参考链接:https://www.runoob.com/python3/python3-basic-operators.html