Need help converting text to csv format

alex23 wuwei23 at
Sat Nov 22 01:57:37 CET 2008

On Nov 22, 2:28 am, Joe Strout <j... at> wrote:
> A follow-up question here... is it really necessary to close things  
> like files in Python?

Not if you use a context manager (2.6+, available in 2.5 from

with open('data.csv', 'wb') as csvfile:
  writer = csv.writer(csvfile)

The file is guaranteed to be closed at the end of the with-statement

More information about the Python-list mailing list