摘要: 1. 安装 pip install tqdm 2. 一般的进度条管理 import tqdm #for index,(data,targets) in enumerate(train_loader): for data,targets in tqdm(train_loader): pass 若只输出 阅读全文
posted @ 2021-06-16 13:11 秋夜花开 阅读(664) 评论(0) 推荐(1) 编辑
摘要: >>> bin(10)'0b1010'>>> bin(100)'0b1100100'>>> 10^100110python中的异或运算符为 ^ eg: 2^3 = 1即分别求出2和3的二进制,再进行比较,相同为0,不同为1 10^11 = 1 再转换为十进制即为1 4^7 = ob100^ob111 阅读全文
posted @ 2020-10-11 10:49 秋夜花开 阅读(9281) 评论(0) 推荐(0) 编辑
摘要: <!-- 在head中添加如下代码 --><head> <style> html{ filter: grayscale(100%); } </style> </head> 效果: 阅读全文
posted @ 2020-09-16 15:52 秋夜花开 阅读(189) 评论(0) 推荐(0) 编辑
摘要: F12,过滤器选font,找到woff文件, woff转成ttf https://www.fontke.com/tool/convfont/ ttf在百度字体编辑器里打开 http://fontstore.baidu.com/static/editor/index.html# 批量导出字形(F12, 阅读全文
posted @ 2020-07-31 13:59 秋夜花开 阅读(465) 评论(0) 推荐(0) 编辑
摘要: #类装饰器 class Foo(object): def __init__(self, func): self._func = func def __call__(self): print ('class decorator runing') self._func() print ('class d 阅读全文
posted @ 2020-07-17 13:55 秋夜花开 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 用来记录一个函数的运行时间 #定义一个函数用来统计传入函数的运行时间def timmer(func): #传入的参数是一个函数 def deco(*args, **kwargs): #本应传入运行函数的各种参数 print('\n函数:{_funcname_}开始运行:'.format(_funcn 阅读全文
posted @ 2020-07-17 11:33 秋夜花开 阅读(2121) 评论(0) 推荐(0) 编辑
摘要: 用列表推导式代替for循环创建列表 @timmer def test1(): a = [] for i in range(100000): a.append(i) # print(a) @timmer def test2(): a = [i for i in range(100000)] # pri 阅读全文
posted @ 2020-07-17 11:31 秋夜花开 阅读(1477) 评论(0) 推荐(0) 编辑
摘要: 刚开始写代码时需要进行很多的测试,常常会在程序中穿插print语句来查看某一步的执行结果,但每次重新 运行后输出结果都会被覆盖掉,而此时如果print语句过多那么分别将之写入文件也是不太可行的,此时有两种方法。 ##1. 命令行里运行命令,然后重定向输出至文件 python test.py > te 阅读全文
posted @ 2020-07-09 13:45 秋夜花开 阅读(651) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-07-05 20:56 秋夜花开 阅读(107) 评论(0) 推荐(0) 编辑
摘要: import os Path = os.getcwd() #获取当前目录 # Path = r"F:\照片\手机照片" print("listdir:") #listdir只会显示当前目录下的所有文件和文件夹 print(os.listdir(Path)) print("-"*10) print(' 阅读全文
posted @ 2020-07-05 20:53 秋夜花开 阅读(360) 评论(0) 推荐(0) 编辑