''' This program does this: opens a file for reading opens another file for writing each number is read, multiplied by 2, and written to the output file ''' input_file_name = 'numbers.txt' output_file_name = 'numbers_doubled.txt' in_handle = open(input_file_name, 'r') out_handle = open(output_file_name, 'w') lines = in_handle.readlines() for line in lines: fields = line.split() for field in fields: number = int(field) number *= 2 out_handle.write(str(number) + ' ') out_handle.write('\n') in_handle.close() out_handle.close()