# 以下代码为test.pyimport os
import time
print('-'*30)for i inrange(20):try:
d='[www.xiazaiba.com]'
f=os.popen('dir /s /b').readlines()for i in f:
i=i.strip()file=i.split('\\')[-1]if d infile:
name1=i.split('\\')[-1]
name2=i.split(']')[-1]
path=i[0:-len(name1)-1]# print(path)
os.chdir(path)print(name1)
os.system('rename {} {}'.format(name1,name2))except:passif name1:passelse:breakfor i inrange(20):try:
d='[www.xiazaiba.com]'
f=os.popen('dir /s /b').readlines()for i in f:
i=i.strip()file=i.split('\\')[-1]if d infile:
name1=i.split('\\')[-1]
name2=i.split(']')[-1]
path=i[0:-len(name1)-1]# print(path)
os.chdir(path)print(name1)
os.system('rename {} {}'.format(name1,name2))except:passif name1:passelse:break# 以下文件为可运行pyimport os
for i inrange(3):
os.system('python test1.py')
``