operation with strings and numbers

Ville Vainio ville at spammers.com
Fri Oct 15 20:18:40 CEST 2004


>>>>> "Hellas" == Hellas  <hellas_74 at hotmail.com> writes:

    Hellas> Hello guy

    Hellas> I'm italian boy, I need help for doing a strange thing
    Hellas> with numbers

Did you mean Italian SCHOOLboy, be any chance? Don't be afraid to say
so, because everyone can guess anyway.



    Hellas> I have a number from operation like this:
    Hellas> a = float("010.123")
    Hellas> b = float("001.124")
    Hellas> p= a*b
    Hellas> p="%06.3f" % p
    Hellas> the resulted is "_11,278" where "_" is a space

No, it isn't. 

In [6]: "%06.3f" % p
Out[6]: '11.378'


In [7]: "%07.3f" % p
Out[7]: '011.378'

    Hellas> I must to change the formatting of this number in "011278"
    Hellas> but I don't known

In [8]: "lunttaus".replace("t","")
Out[8]: 'lunaus'

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list