string formatting question

Erno Kuusela erno-news at erno.iki.fi
Fri Jan 5 19:52:18 EST 2001


In article <3a5660f8.626036031 at localhost>, victor at prodigy.net (Victor
Muslin) writes:

| >>> '%d' % 123123123123123123L
| produces an OverflowError exception. Surely there is something simple
| I am overlooking in the manual, but none of the other format
| specifiers described seemed to be appropriate.

this is fixed in python 2.0

meanwhile, like another poster suggested, you can use %s or str().
however, these leave you with a L suffix in the string.
however**2, the L suffix has also been "fixed" in 2.0, so
the str(123123123123123123L)[:-1] that would work in 1.5.2 will
break in 2.0.

it's not a pretty sight...

  -- erno



More information about the Python-list mailing list