python手册笔记
1.字符串
s='Spam'
s.find('a') 返回偏移量,找不到返回 -1
s.replace('a','xyz') 搜索全部,替换
s.split(',') 按‘,’切割成子字符串
s.upper() 全部转为大写字母
s.isalpha() 判断 isdigit etc
s.rstrip() 删除右侧的空格和/n等字符
数组
movies = ["1","2"]
movies.append["3"] 数据添加到末尾
movies.pop() 弹出尾部数据
movies.extend["00","01"]表的尾部插入表
remove() 列表中删除特定数据项
insert(3,“hello”)特定位置(表的下标)前加数据项
字符串中用“,,转义\"或 ‘ ” ’
isinstance(变量,类型)判断变量是否是**类型
isinstance(movies,list)
定义函数,递归
def print_lol(the_list):
for each_film in the_list:
if isinstance(each_film,list):
print_lol(each_film)
else:
print (each_film)
--积跬步,至千里!--