[Tutor] Need a little help in formatting print statement

Anubhav Yadav anubhav1691 at gmail.com
Sun Dec 7 18:01:21 CET 2014


> If your code is short enough, say, less than 50 lines, please include it
> directly in your email. Some of us are reading and replying to posts at
> a time where it is inconvenient to access the web, or at least parts of
> the web.
>
> Yes sure, next time I will keep that in mind.


> Try using the %r formatter:
>
> py> for x in (1995262.314969, 1995262314968.882812,
> ...           2818382931264449024.0, 11220184543019653120.0):
> ...     print( "%r" % x )  # same as print(repr(x))
> ...
> 1995262.314969
> 1995262314968.8828
> 2.818382931264449e+18
> 1.1220184543019653e+19
>
>
I had read about this formatter before, thanks a lot. Cheers!!


-- 
Regards,
Anubhav Yadav
KPIT Technologies,
Pune.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141207/f1027337/attachment.html>


More information about the Tutor mailing list