Most efficient way to write data out to a text file?

candiazoo at attbi.com candiazoo at attbi.com
Thu Jun 27 14:14:55 EDT 2002


trs_file.write("T%32d%-251s%-29s%-13s%-9s%6.2f%6.2f%-16s\n" % \
	(wrk_inst, title[0:251], pub_name[0:29], \
         std_num[0:13], date_range, base_fee, \
         page_fee, source_id))

This is how I am writing the record[s] now.  Not much gain but the other thing
is I need to handle nulls returned from the database (none values in pub_name)
and I need to limit the size (as you can see) of some of the fields because the
database field is much larger than the text field allows...

Mike



More information about the Python-list mailing list