On 2012-10-23, at 10:24 PM, David Hutto <dwightdhu...@gmail.com> wrote:
> count = 0 Don't use count. > for file_data in turn_text_to_txt: Use enumerate: for count, file_data in enumerate(turn_text_to_txt): > f = open('/home/david/files/%s_%s.txt' % (file_data.split(' ')[0], count), > 'w') Use with: with open('file path', 'w') as f: f.write('data') Not only is it shorter, but it automatically closes the file once you've come out of the inner block, whether successfully or erroneously. Demian Brecht @demianbrecht http://demianbrecht.github.com -- http://mail.python.org/mailman/listinfo/python-list