Cutting off trailing zeroes?

Janos Blazi jblazi at netsurf.de
Sat Jan 29 09:07:15 EST 2000


Thx. I am such a stupid person! I *saw* that python put it right when I
wrote "print x" and I *knew* i was able to do the same but I could not
figure out how. Oh God!.

J.B.



Gerrit Holl <gerrit.holl at pobox.com> schrieb in im Newsbeitrag:
20000129142714.A2146 at stopcontact.palga.uucp...
> Janos Blazi wrote on 949137250:
> > Id like to format a string like this:
> >   s = "(%f)" % x
> >
> > Now if x=1.5 then s="1.50000" or something like this. Is there a
tirivial
> > way of cutting of the zeroes, i.e. getting s="1.5" instead of
s="1.50000"?
> >
> > Of course it can be programmed very simply. My question is: can I do it
with
> > specifiers somehow?
>
> s = "(%s)" % str(x)
>
> regards,
> Gerrit.
>
> --
> Please correct any bad English you encounter in my email message!
> -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
> Version: 3.12
> GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V
PS+ PE?
> Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
> -----END GEEK CODE BLOCK-----
>




  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----



More information about the Python-list mailing list