[Tutor] How to print complex numbers without enclosing parentheses
Stephen McInerney
spmcinerney at hotmail.com
Fri Sep 19 11:26:27 CEST 2008
Why does the complex.__str__() method on complex numbers add the enclosing parentheses?
It's unwanted, and it also makes them look like a tuple (other than the trailing comma).
How can I get rid of it, other than the clunky:
>>> print d(0.80-0.58j)>>> print repr(d)[1:-1]0.80-0.58j
How can I change complex.__str__() ?
Thanks,
Stephen
_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080919/e241b438/attachment.htm>
More information about the Tutor
mailing list