new_name = ''
biaoji = False
for itype in type:
if fnmatch.fnmatch(filename,'*'+itype):
new_name = filename[:-len(itype)] + '.txt'
biaoji = True
break
if biaoji==False:
print('格式不正确')
exit(0)这样显得代码很烂,有没有简洁好看的方法
添加回答
举报
0/150
提交
取消