for/write → writelines

This commit is contained in:
Remy Oukaour 2018-01-03 15:35:25 -05:00
parent c85e4f3d52
commit 78c818e4c9
1 changed files with 3 additions and 4 deletions

View File

@ -25,7 +25,7 @@ def total_bank_size(type):
} }
return sizes[type] return sizes[type]
def sorted_mapfile(input): def map_to_sym(input):
# analogous to ";File generated by rgblink" # analogous to ";File generated by rgblink"
yield ';File generated by sort_map.py\n' yield ';File generated by sort_map.py\n'
@ -117,10 +117,9 @@ def main():
output_filename = sys.argv[2] output_filename = sys.argv[2]
with open(input_filename, 'r') as infile: with open(input_filename, 'r') as infile:
input = infile.readlines() input = infile.readlines()
output = sorted_mapfile(input) output = map_to_sym(input)
with open(output_filename, 'w') as outfile: with open(output_filename, 'w') as outfile:
for line in output: outfile.writelines(output)
outfile.write(line)
if __name__ == '__main__': if __name__ == '__main__':
main() main()