摘要: 列表的增删改查 1,增 a=[1,2,3,4] a.append("n") #追加 print(a) #[1, 2, 3, 4, 'n'] a.insert(1,"wo") #按位置加 print(a) #[1, 'wo', 2, 3, 4, 'n'] a.extend("abc") #迭代去加 p 阅读全文
posted @ 2018-08-22 21:35 若兮ruoxi 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 一,print() print('a','b','c') print('a','b','c',sep="&",end="?") f=open(file,mode="w",encoding="utf-8") print("666",file=f) # 将666写入文件f中 二,sum()sum(可迭代 阅读全文
posted @ 2018-08-22 17:41 若兮ruoxi 阅读(77) 评论(0) 推荐(0) 编辑
摘要: def func(x,y): pass func(3,y=4) 1,函数的定义和调用 def 函数名(): 函数体 调用函数:函数名() 2,函数的返回值 a,没有返回值 def func(): print(666) func() 不写return,会默认返回None 只写return,也会返回No 阅读全文
posted @ 2018-08-22 15:38 若兮ruoxi 阅读(148) 评论(0) 推荐(0) 编辑