One possibility is to form the string as usual, split on the "e", format each
part separately, then rejoin with an "e".
On Tuesday, March 5, 2013 12:09:10 PM UTC-8, fa...@squashclub.org wrote:
> Instead of:
>
>
>
> 1.8e-04
>
>
>
> I need:
>
>
>
> 1.8e-004
>
>
>
> So two zeros before t
On 6 mar, 15:03, Roy Smith wrote:
> In article ,
>
> fa...@squashclub.org wrote:
> > Instead of:
>
> > 1.8e-04
>
> > I need:
>
> > 1.8e-004
>
> > So two zeros before the 4, instead of the default 1.
>
> Just out of curiosity, what's the use case here?
--
>>> from vecmat6 import *
>>> from s
In article ,
fa...@squashclub.org wrote:
> Instead of:
>
> 1.8e-04
>
> I need:
>
> 1.8e-004
>
> So two zeros before the 4, instead of the default 1.
Just out of curiosity, what's the use case here?
--
http://mail.python.org/mailman/listinfo/python-list
On 3/5/2013 3:09 PM, fa...@squashclub.org wrote:
Instead of:
1.8e-04
I need:
1.8e-004
So two zeros before the 4, instead of the default 1.
The standard e and g float formats do not give you that kind of control
over the exponent. You have to write code that forms the string you
want. You can
On 03/05/2013 03:09 PM, fa...@squashclub.org wrote:
Instead of:
1.8e-04
I need:
1.8e-004
So two zeros before the 4, instead of the default 1.
You could insert a zero two characters before the end,
num = "1.8e-04"
num = num[:-2] + "0" + num[-2:]
But to get closer to your problem, could yo
Instead of:
1.8e-04
I need:
1.8e-004
So two zeros before the 4, instead of the default 1.
--
http://mail.python.org/mailman/listinfo/python-list