摘要: level = 'L0' n = 22 def func(): level = 'L1' n = 33 s =88 print(locals()) def outer(): n = 44 level = 'L2' print(locals(),n) def inner(): level = 'L3' 阅读全文
posted @ 2021-04-19 23:05 ty1539 阅读(45) 评论(0) 推荐(0) 编辑
摘要: def selfAdd(a): a += a a_int = 1 print('a_int1:',a_int) selfAdd(a_int) print('a_int2:',a_int) 输出结果: a_int1: 1 a_int2: 1 a_list =[1,2] print('a_list1:' 阅读全文
posted @ 2021-04-19 22:54 ty1539 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 2.1.调用glob 遍历指定目录下的所有文件和文件夹,不递归遍历,需要手动完成递归遍历功能。 import glob as gb path = gb.glob('W:\word2pdf\*') for path in path: print ('方法一path: ',path) print(' ' 阅读全文
posted @ 2021-04-19 22:34 ty1539 阅读(392) 评论(0) 推荐(0) 编辑
摘要: class S(): def go(self): print ("go s go!") def stop(self): print ("stop A stop!") class A(): def go(self): print ("go A go!") def stop(self): print ( 阅读全文
posted @ 2021-04-19 22:22 ty1539 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 购买东西 #_*_ encoding: utf-8 _*_ @author: ty hery 2018/12/29 product_list = [ ('Iphone',5000), ('book',10), ('watch',10600), ('bike',800), ] shopping_lis 阅读全文
posted @ 2021-04-19 14:29 ty1539 阅读(70) 评论(0) 推荐(0) 编辑
摘要: #_*_ encoding: utf-8 _*_ @author: ty hery 2019/8/28 class MySQL: def __init__(self,ip,port,id): self.id=id self.ip=ip self.port=port def tell_info(sel 阅读全文
posted @ 2021-04-19 09:29 ty1539 阅读(42) 评论(0) 推荐(0) 编辑