2020年4月2日

python(函数、参数类型、递归)草稿

摘要: 递归# 递归 自己调用自己count = 0def test1(): # num = int(input('please enter a number:')) global count count+=1 num = 8 if num % 2 == 0: # 判断输入的数字是不是偶数 pass pri 阅读全文

posted @ 2020-04-02 21:31 奥喵 阅读(181) 评论(0) 推荐(0) 编辑

python(集合)

摘要: 集合 天生去重,无序 s = set() #新增空集合 花括号,类似字典,不过是单个元素,不是key,value的键值对 集合范例:s = {‘1’,‘2’,‘3’} s2 = {'1','2','3','4'}s3 = {'1','2','5'} #集合是无序的,所以没有办法通过下标取值 s2.a 阅读全文

posted @ 2020-04-02 12:30 奥喵 阅读(94) 评论(0) 推荐(0) 编辑

练习,替换txt文档中的信息

摘要: import oswith open('b','a+',encoding= 'utf-8') as f,open('b2.bak','w',encoding= 'utf-8') as f2: f.seek(0) for i in f: new_i = i.replace('一','二') f2.wr 阅读全文

posted @ 2020-04-02 11:05 奥喵 阅读(176) 评论(0) 推荐(0) 编辑

导航