会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Twaine
博客园
首页
新随笔
联系
订阅
管理
2021年6月16日
tqdm进度条管理
摘要: 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 秋夜花开
阅读(713)
评论(0)
推荐(1)
2020年10月11日
python异或运算
摘要: >>> 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 秋夜花开
阅读(9402)
评论(0)
推荐(0)
2020年9月16日
给网页添加黑白效果
摘要: <!-- 在head中添加如下代码 --><head> <style> html{ filter: grayscale(100%); } </style> </head> 效果:
阅读全文
posted @ 2020-09-16 15:52 秋夜花开
阅读(192)
评论(0)
推荐(0)
2020年7月31日
提取woff/tff中的矢量图
摘要: 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 秋夜花开
阅读(529)
评论(0)
推荐(0)
2020年7月17日
装饰器
摘要: #类装饰器 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 秋夜花开
阅读(100)
评论(0)
推荐(0)
python函数计时器(通过装饰器实现)
摘要: 用来记录一个函数的运行时间 #定义一个函数用来统计传入函数的运行时间def timmer(func): #传入的参数是一个函数 def deco(*args, **kwargs): #本应传入运行函数的各种参数 print('\n函数:{_funcname_}开始运行:'.format(_funcn
阅读全文
posted @ 2020-07-17 11:33 秋夜花开
阅读(2153)
评论(0)
推荐(0)
关于for循环的速度优化
摘要: 用列表推导式代替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 秋夜花开
阅读(1499)
评论(0)
推荐(0)
2020年7月9日
关于print输出指向到文件
摘要: 刚开始写代码时需要进行很多的测试,常常会在程序中穿插print语句来查看某一步的执行结果,但每次重新 运行后输出结果都会被覆盖掉,而此时如果print语句过多那么分别将之写入文件也是不太可行的,此时有两种方法。 ##1. 命令行里运行命令,然后重定向输出至文件 python test.py > te
阅读全文
posted @ 2020-07-09 13:45 秋夜花开
阅读(688)
评论(0)
推荐(0)
2020年7月5日
图片分类
摘要:
阅读全文
posted @ 2020-07-05 20:56 秋夜花开
阅读(144)
评论(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 秋夜花开
阅读(369)
评论(0)
推荐(0)
下一页
公告