def jieya(): i = "0653.zip" for x in range(10000): ss = i[:i.find(".")] print(i) zpf = zipfile.ZipFile(dir + ss + ".zip") list = zpf.namelist() # 得到压缩包里所有文件 for f in list: zpf.extract(f, dir, ss.encode('utf-8')) # 循环解压文件到指定目录,密码 print(ss + "解压成功" + str(f)) i = str(f)
#这里注释掉的代码是一个字典,记录重复的文件名,没有用 '''t = {} for i in range(10000): s = str(i) while len(s) < 4: s = '0' + s t[s] = False'''
import numpy as np import cv2 as cv I=np.zeros((200,200),dtype=np.uint8)
with open(r'C:/Users/brighten/Desktop/qr.txt', 'r') as f: count=0 for line in f: print(line) print(line[1:4]) if str(line[1:4])=='255': I[count//200][count%200]=255 else: I[count // 200][count % 200] = 0 count+=1 cv.imwrite("1.png",I) print(I)