打造一个000-999的字典
for i in range(1000): if i<10: i = '00'+str(i) elif 10<=i and i<100: i ='0'+str(i) else: i=str(i) with open('1.txt', 'a') as f: f.write(i+" ")