Skip to content

Instantly share code, notes, and snippets.

@categulario
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save categulario/ba28805aa645bff73c33 to your computer and use it in GitHub Desktop.

Select an option

Save categulario/ba28805aa645bff73c33 to your computer and use it in GitHub Desktop.
one line code to put commas on a large number (python3)
number = 3988322153843625493168050
with_commas = ''.join([['', ','][i%3==0]+a for i, a in enumerate(str(number)[::-1])])[:0:-1]
print(with_commas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment