You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import time
import os
class Mythread(Thread):
def __init__(self,path):
super().__init__()
self.path=path
def run(self):
path=self.path
files = []
dirs = []
for (dirpath, dirnames, filenames) in os.walk(path):
# files += filenames
# dirs += dirnames
# print(files)
# print(dirs)
for fn in filenames:
filepath=os.path.join(dirpath,fn)
with open(filepath,encoding='utf8')as f:
text=f.read()
print(text)
filepath=[r'C:\Users\10396\Desktop\新建文件夹',r'C:\Users\10396\Desktop\新建文件夹 (2)']
t=[]
for i in range(2):
t1=Mythread(filepath[i])
#print(f'我是主线程{i}')
t1.start()
t.append(t1)
for i in t:
i.join()
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: