hallo everybody,
I am trying to create a string file that is like:
a_01
a_02
a_03
.
.
a_10
Is it possible to convert a nuber to a string? Is it possible in python?
thanks
GS
hallo everybody,
I am trying to create a string file that is like:
a_01
a_02
a_03
.
.
a_10
Is it possible to convert a nuber to a string? Is it possible in python?
thanks
GS
Your question is more into core Python rather than Py60.
I think you are a newbie to python.
Go through the docs for better understanding
http://docs.python.org/tut/
Best Regards
Croozeus
Pankaj Nathani
www.croozeus.com
Try...
In addition to the 'str' function, you can use a printf-style format specifier as used in the above code. Examples...Code:f = open('outfile', 'w') for i in range(1, 11): f.write('a_%02d\n' % i) f.close()
Code:'%d' % 1 -> '1' '%2d' % 1 -> ' 1' '%3d' % 1 -> ' 1' '%02d' % 1 -> '01' '%03d' % 1 -> '001'