0

I've read some other threads about the Python trailing L problem, such has Why does python add an 'L' on the end of the result of large exponents?, Python Trailing L Problem, Why do integers in database row tuple have an 'L' suffix?. But I didn't find an answer that exactly clears up my confusion.

As mentioned here Why does python add an 'L' on the end of the result of large exponents?, I got the following

>>> 25 ** 25
88817841970012523233890533447265625L

>>> str(25**25)
'88817841970012523233890533447265625'

so using str(25**25) will not show the trailing L, but I also got

>>> str([25,25**25])
'[25, 88817841970012523233890533447265625L]'

if str is applied to a list of numbers the L shows up again, could someone explain why this is so?

What should be a simple way to get the string [25, 88817841970012523233890533447265625] from the list [25,25**25]?


currently what I'm doing is

>>> "["+", ".join((map(str, [25,25**25])))+"]"
'[25, 88817841970012523233890533447265625]'
Community
  • 1
  • 1
dontloo
  • 10,067
  • 4
  • 29
  • 50

0 Answers0