python 基础总结复习

一、标识符

1、字母数字下划线组成

2、不能以数字开头

3、不能以保留字命名

4、区分大小写

5、描述性的单词,不要中文拼音

6、驼峰式 下划线分割

二、算数运算符

+、-、*、/、//、%、**

三、赋值运算符

=、+=、-=、*=、/=、//= 、**=、%=

四、比较运算符

>、<、>=、<=、!=、==

五、逻辑运算符

and or not

六、身份运算符

is

七、成员运算符

in not in

八、数值类型

1、字符串
‘string’  "string"  """string"""  'he\'s sad'

b="he is happy \n Yes"

b=repr("he is happy \n Yes") (repr)方便电脑阅读的

b=r"he is happy \n Yes"  r防止转义字符串

str[start:end:step]//切片

2、布尔

3、列表

["",""]

4、元组

("","")

5、字典

{"key":"Value"}

九、逻辑判断

if while for

十、文件操作

猜你喜欢

转载自www.cnblogs.com/FashionDoo/p/9092029.html