Python 2.6.6 (r266:84292, Dec 5 2011, 09:38:23) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> format('n', 100000000) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: format expects arg 2 to be string or unicode, not int
Comment
Sorry, but I don't see any reference to the 'n' format in the post, its update, or any of the other comments.
Parent comment
See the UPDATE to the post above.
Replies
Python 2.6.6 (r266:84292, Dec 5 2011, 09:38:23)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> format('n', 100000000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: format expects arg 2 to be string or unicode, not int
My apologies, I was working on two different computers and retyped the code snippet incorrectly. The correct code should of course be:
import locale
locale.setlocale(locale.LC_ALL, '')
def f5(n):
return format(n, 'n')