kod = list(range(0,1000)) for s in kod: param = "S" + str(s).zfill(3) our_sayı = str(param) with open("out.txt", "a") as myfile: myfile.write(our_sayı + '\n')