1 2 3 4 5 ··· 44 下一页
摘要: import pytesseract from PIL import Image pytesseract.pytesseract.tesserac_cmd = r'D:\Tesseract-OCR\tesseract.exe' tessdat.dir.config = r'--tessdata-di 阅读全文
posted @ 2023-11-05 18:47 ty1539 阅读(21) 评论(0) 推荐(0) 编辑
摘要: from multiprocessing import Pool def double(x): print(x**2) return x**2 if __name__ == '__main__': pool = Pool() pool.map(double, list(range(11))) pri 阅读全文
posted @ 2023-11-04 21:55 ty1539 阅读(96) 评论(0) 推荐(0) 编辑
摘要: expr_str="[1,2,3]" my_list=eval(expr_str) print(repr(my_list),type(my_list)) # [1,2,3] print(repr(expr_str),type(expr_str)) #'[1,2,3]' import ast # 用i 阅读全文
posted @ 2023-10-29 17:18 ty1539 阅读(23) 评论(0) 推荐(0) 编辑
摘要: import operator somelist = [(1,5,8),(6,2,4),(9,7,5)] somelist.sort(key=operator.itemgetter(0)) print(somelist) # [(1, 5, 8), (6, 2, 4), (9, 7, 5)] som 阅读全文
posted @ 2023-10-29 17:02 ty1539 阅读(6) 评论(0) 推荐(0) 编辑
摘要: ``` ## 快速求2的n次幂 print(10>>1) print(13>>1) print(131011 if (x & 1) == 0: print( 'x是偶数') else: print( 'x是奇数') ``` ``` ''' 交换两个元素''' a, b = 1, 2 a ^= b b 阅读全文
posted @ 2023-08-14 13:57 ty1539 阅读(15) 评论(0) 推荐(0) 编辑
摘要: ``` package main import ( "fmt" "strings" ) func makeSuffixFunc(suffix string) func(string) string { return func(name string) string { if !strings.Has 阅读全文
posted @ 2023-06-13 10:35 ty1539 阅读(16) 评论(0) 推荐(0) 编辑
摘要: ## 如何为元祖中的每个元素命名,提升可读性 ![](https://img2023.cnblogs.com/blog/1304933/202305/1304933-20230509000229089-318279766.png) ## 方法1, index命名: ![](https://img20 阅读全文
posted @ 2023-05-22 22:28 ty1539 阅读(10) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2023.cnblogs.com/blog/1304933/202305/1304933-20230509230501310-541330073.png) ![](https://img2023.cnblogs.com/blog/1304933/202305/1304933-20230509230527473-404255210.png) ![](https://im 阅读全文
posted @ 2023-05-09 23:10 ty1539 阅读(14) 评论(0) 推荐(0) 编辑
摘要: ## ![](https://img2023.cnblogs.com/blog/1304933/202305/1304933-20230509003224765-1453557723.png) ![](https://img2023.cnblogs.com/blog/1304933/202305/1304933-20230509003138690-2106351860.png) ![](https 阅读全文
posted @ 2023-05-09 00:38 ty1539 阅读(20) 评论(0) 推荐(0) 编辑
摘要: dict.fromkeys(data,0) 默认字典,把data里面的值作为key,赋值给0 Counter对象的most_common(3)取出出现频率最高的3个 读取文件, 用re.split("\W+",txt)非字符进行分割,再用Counter进行处理 阅读全文
posted @ 2023-05-09 00:31 ty1539 阅读(16) 评论(0) 推荐(0) 编辑
1 2 3 4 5 ··· 44 下一页