print longs

Clement clement at ans.com.au
Wed Oct 6 19:42:42 EDT 1999


What OS are you using?  In my Redhat 6/Python 1.5.2, I have this,

>>> print '%d' % 9876543219876541L
Traceback (innermost last):
  File "<stdin>", line 1, in ?
OverflowError: long int too long to convert

>>> print '%d' % 987654321L
987654321

Emile van Sebille wrote:
> 
> Did I miss something?
> 
> >>> print '%d' % 987654321987654321L
> 987654321987654321L
> >>> print '%d' % 987654321987654321L
> Traceback (innermost last):
>   File "<pyshell#5>", line 1, in ?
>     print '%d' % 987654321987654321L
> OverflowError: long int too long to convert
> >>>
> 
> --
> 
> Emile van Sebille
> emile at fenx.com
> -------------------
> 
> Clement <clement at ans.com.au> wrote in message
> news:37F98517.DD12EF2F at ans.com.au...
> > Try '%d'
> >
> > Greg Ewing wrote:
> > >
> > > Nathan Clegg wrote:
> > > >
> > > > Do I have to convert
> > > > to a string and manually pull the 'L' off?
> > >
> > > Unfortunately, yes. Many other people think this
> > > is a pain as well, but Guido doesn't seem to be
> > > among them, so we're stuck with this for the time
> > > being.
> > >
> > > Greg
> >
> > --
> >
> > Regards
> >
> > Clement

-- 

Regards

Clement




More information about the Python-list mailing list