Writing to a file prints integers to my IDLE shell. They seem to range from 15-40 and there's one for every line printed to my file.
This only occurs if I write the statement directly in IDLE, outside of a function. This causes the integers to print:
>> file = open('filename', 'w')
>> for element in list:
file.write('{}\n'.format(element))
while this doesn't:
>> def print_to_file():
file = open('filename', 'w')
for element in list:
file.write('{}\n'.format(element))
file.close()
>> print_to_file()
I'm using IDLE 3.4.0 on Windows 7. I haven't had the opportunity to test it on another machine or another version of IDLE.