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
提交
取消