摘要: #读取文件夹中文件的路径#方法一import osimport shutilwenjianjia=r'D:\Desktop\内部培训python' #文件夹绝对路径#r的作用是去除转义字符lujing=os.listdir(wenjianjia) #获取文件夹中所有文件的相对路径返回一个列表for 阅读全文
posted @ 2023-06-09 21:41 白小火 阅读(207) 评论(0) 推荐(0)
摘要: a = input('请输入num')if int(a)<=10: print(a+'小于等于10')else: print(a+'大于等于10')#三元条件运算符a = input('请输入num')print(a+'小于等于10' if int(a)<=10 else a+'大于等于10') p 阅读全文
posted @ 2023-05-22 17:50 白小火 阅读(43) 评论(0) 推荐(0)
摘要: 1,自定义所需要的函数。 2,将不同功能的函数封装形成类(类名称的首字母大写)。 3,将不同的类或函数放在一个以.py的文件中形成模块。 例: 第一部分函数 #写函数,接收n个数字,求这些数字的和def a(num): sum = 0 for i in num: if type(i) == int: 阅读全文
posted @ 2023-05-17 21:05 白小火 阅读(56) 评论(0) 推荐(0)
摘要: #用字典存储2维表数据d1 = {'name':'张三','age':18,'city':'南阳'}d2 = {'name':'李四','age':17,'city':'内乡'}d3 = {'name':'王五','age':19,'city':'漳州'}dt = [d1,d2,d3]print(d 阅读全文
posted @ 2023-05-15 20:06 白小火 阅读(294) 评论(0) 推荐(0)
摘要: #序列解包 a = {10: 500, 20: 200, 30: 300, 40: 400, '委员会设立情况': '公司治理'} z,b,c,d,e = a #返回键 print(z) print(e) f,j,h,i,g = a.values() #返回值 print(f) print(g) k 阅读全文
posted @ 2023-05-15 19:28 白小火 阅读(42) 评论(0) 推荐(0)
摘要: #字典新增键值对=、update(a中没有的增加,键相同的后增加的覆盖之前的)a = {10: 100, 20: 200, 30: 300}b = {'委员会设立情况': '公司治理',10:500}a[40]=400print(a) #{10: 100, 20: 200, 30: 300, 40: 阅读全文
posted @ 2023-05-15 19:03 白小火 阅读(38) 评论(0) 推荐(0)
摘要: #反选a = 'ACXDSFDV CDVFFB'[::-1]# a = a.replace('C','ni')b = 'ACXDSFDV CDVFFB'[::-2]print(a)print(b)#频繁修改字符串,可以这样做。import ios = 'axscgv mkoi'sio = io.St 阅读全文
posted @ 2023-05-15 18:37 白小火 阅读(23) 评论(0) 推荐(0)
摘要: import turtle#第一个圈turtle.width(10) #画笔宽度10turtle.color("black") #画笔的颜色turtle.circle(50) #半径50的圆#第二个圈turtle.penup() #抬笔turtle.goto(110,0) #去到坐标(110,0)t 阅读全文
posted @ 2023-05-06 18:23 白小火 阅读(1882) 评论(0) 推荐(0)
摘要: #T 要求输出'./a/text()url_gglb_xpath_dic = { '中国邮政储蓄银行': { '发行公告': [ 'https://www.psbc.com/cn/grfw/tzlc/lc/ywgg/lcxsgg/index_页码.html', 'https://www.psbc.c 阅读全文
posted @ 2023-05-06 18:04 白小火 阅读(292) 评论(0) 推荐(0)
摘要: gglb_key_dic = { '广西北部湾银行股份有限公司': { '分红公告': ['理财产品公告', '分红方案'], '基本信息': ['转置', '关于发售'], '到期公告': ['转置', '清算报告', '到期兑付'], '成立公告': ['成立公告'], '净值公告': ['产品 阅读全文
posted @ 2023-05-06 17:58 白小火 阅读(89) 评论(0) 推荐(0)