import configparser with open("pokemon.txt","r",-1,"utf_8") as pbsfile: config=configparser.RawConfigParser() config.optionxform=str # Must be capitalized, so this is here pbsfile.seek(3) config.read_file(pbsfile) for i in range(1,(493+1)): # This is the range that you want to do. 1 is the start, 439 is the end # work with config gets and sets, read the pydocs. super easy with open("newpbs.txt","a",-1,"utf_8") as newfile: newfile.write('\ufeff') #Dealing with the PBS file config.write(newfile,space_around_delimiters=False)