[ python-Bugs-1741524 ] defined format returns error

SourceForge.net noreply at sourceforge.net
Fri Jun 22 16:05:00 CEST 2007


Bugs item #1741524, was opened at 2007-06-22 13:56
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1741524&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Ted Bell (ted7234889)
Assigned to: Nobody/Anonymous (nobody)
Summary: defined format returns error

Initial Comment:
print round(i[,2])
This returned the error invalid syntex but this round( x[, n]) is out it is shown the reference library under 2.1 Built in functions. I have tried leaving out the comma as well asvarious other combinations to no avail, can someone help please, I need to round a number to two decimal places before outputting to the user.

Ted


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-06-22 14:05

Message:
Logged In: YES 
user_id=849994
Originator: NO

The square brackets indicate an optional argument:

print round(i)
print round(i, 2)

are both valid calls of round().

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1741524&group_id=5470


More information about the Python-bugs-list mailing list