[Tutor] specifying precision with scientific notation

ALAN GAULD alan.gauld at btinternet.com
Wed Oct 6 09:26:51 CEST 2010





> But something like the "%.%de " %n is exactly what I am looking  for - if I 
>could get it to  work.

Sorry my bad, I missed a % sign:

>>> n=5
>>> "%%.%de" % n
'%.5e'

You need two %% to create a % in the output.

Alan G.


More information about the Tutor mailing list