Writting to specific location in a file
Michael Hoffman
cam.ac.uk at mh391.invalid
Tue Feb 22 19:16:35 EST 2005
artixan at gmail.com 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 = ("a", "b")
print " %-16s%-16s" % row
http://docs.python.org/lib/typesseq-strings.html
--
Michael Hoffman
More information about the Python-list
mailing list