Re: Writting to specific location in a file

2005-02-22 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: My chanllenge is that each field needs to have a exact specific position in the output file. For instance a_field needs to start at position 2 in the line, b_fields at position 18 and so on, for all the fields on each line. You can use string formatting operations: row = (

Writting to specific location in a file

2005-02-22 Thread artixan
I have a database result set in a Python list. Each row is a tuple. data = [(a_field,b_field,c_field,d_field,x_field,y_field,z_field)] I need to loop thru this data and write each row to a text file. f = open('out.txt','w') for row in data: f.writelines(row) My chanllenge is that each fiel