导图社区 python语法思维导图
这是一篇关于python语法的思维导图,包含变量、数据、判断、循环、函数、类与对象、模块与库等内容。
社区模板帮助中心,点此进入>>
互联网9大思维
组织架构-单商户商城webAPP 思维导图。
域控上线
python思维导图
css
CSS
计算机操作系统思维导图
计算机组成原理
IMX6UL(A7)
考试学情分析系统
python
变量
命名
赋值
类型
全局变量
global
局部变量
数据
字符串str
整数int
浮点数float
列表list
元祖tuple
字典dice
布尔值bool
操作
字符串拼接
print(‘hi’+‘美女’)
print(今天公司来了%d个%s%(no,name))
四则运算
数据转换
type()
str()
int()
float()
list()
len()
语法
列表语法
元素
取改增删
列表
偏移量
list.append()
list1+list2+list3
del list[0]
del list[:2]
列表的切片
list[1:2]
字典语法
键
group = {'师父':'唐三藏', '大师兄':'孙行者', '二师兄':'猪八戒', '沙师弟':'沙 和尚'}
print(group['师父'])
group['师父']='唐玄奘'
group['白龙马']='敖烈'
del group['师父']
函数
dict.keys()
dict.values()
dict.items()
布尔值
bool()
判断
单向判断
if
双向判断
if...else...
多向判断
if...elif...else
IF嵌套
循环
for...in...
dict
dict.values
dict.items
range()
range(b)
range(a,b)
range(a,b,c)
while True
break
continue
else
自定义函数
def
return
def 函数名(参数): 函数体 return 语句
内置函数
类与对象
class
classA(B)
classA(B,C)
def _init_(self)
super()
模块与库
内置模块
自定义模块
.py文件
第三方模块
操作方法
import A
import A as a
from A import B
from A import B,C,D
from A import *
文件读写
打开文件
open(file,mode,encoding)
with open(file,mode,encoding) as f
读写文件
文件语法
read()
readlines()
write()
writelines()
关闭文件
close()
csv文件
reader()
writer()
writerow()
writerows()
os模块
os.getcwd()
其他
str.split()
random()
debug
try...except...