On 16/08/15 22:42, Nym City wrote:
import socket import csv
You don't need csv, you aren't using it.
in_file = open('top500ips.csv', 'r') out_file = open('top500ips_out.csv', 'w') for line in in_file: try: name = socket.gethostbyaddr(line.strip()) out_file.write(line + '\t' + (str(name))
count the parens in the line above...
except socket.herror: out_file.write(line + '\t' + errrMsg) in_file.close() out_file.close()
-- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor