cdecarlo wrote:

>
> fout = open('somefile','w')
> for line in convertedData:
>   fout.write("%s\n" % line)
> fout.close()
>
>  -- or --
>
> fout = open('somefile','w')
> fout.write("%s" % '\n'.join(convertedData))
> fout.close()
>

I'd go for something like...

fout = open('somefile','w')
fout.writelines( line+"\n" for line in convertedData )
fout.close()

Although your first solution should perform about the same.

If you have 2.5, you may prefer this...

with open('somefile','w') as fout:
    fout.writelines( line+"\n" for line in convertedData )


> ... or maybe some hybrid of the two which writes chunks of the
> convertedData list out in one shot ...

The OS should buffer it for you.


Will McGugan

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to