file-writing:formatting
Christoph Lehmann
lehmann at puk.unibe.ch
Fri Dec 13 13:13:20 EST 2002
x looks like (1234.1234, 1, 2345,2345, 'left')
I want to write x to a file, where the first and the third entry should
be rounded to 2 numbers after the comma, and everything nicely
aligned...
how can I do this. the following doesn' t work
for y in x:
number = round(y,2)
f.write(string.rjust(str(number),10))
thanks
c
--
Christoph Lehmann
Department of Psychiatric Neurophysiology
University Hospital of Clinical Psychiatry
Waldau
CH-3000 Bern 60
Switzerland
Phone: ++41 31 930 93 83
Fax: ++41 31 930 96 61
Email: lehmann at puk.unibe.ch
Web:
More information about the Python-list
mailing list