import os
import re
print(__file__)
#===============把所有物品的爆率都改成1/10!!!!!!!!!
if 1:
filenames=[i for i in os.listdir(r'.') if i[0]!='.' and i!='修改爆率.py']
#==============对于爆率低于0.1的批量改成1/10
for i in filenames:
try:
with open(i,'r',encoding='gbk') as f:
tmp=[i for i in f.readlines() if '/' in i]
tmp2=[]
for j1 in range(len(tmp)):
j=tmp[j1].strip()
j=re.sub(' +', ' ', j)
j=re.sub('\t+', ' ', j)
# if int(j.split(' ')[0].split('/')[1])>10:
tmp2.append('1/10 '+''.join(j.split(' ')[1:])+'\n')
# else:
# tmp2.append(j+'\n')
# tmp=[i.split(' ')[0].split('/')[1] for i in tmp]
# a=1
with open(i, 'w',encoding='gbk') as f:
f.writelines(tmp2)
except:
pass
print(filenames)