Skip to content

Instantly share code, notes, and snippets.

@theeluwin
Created January 2, 2015 15:42
Show Gist options
  • Select an option

  • Save theeluwin/391794784221387b8f04 to your computer and use it in GitHub Desktop.

Select an option

Save theeluwin/391794784221387b8f04 to your computer and use it in GitHub Desktop.
def price(value):
parts = str(value).split('.')
parts[0] = re.sub('\B(?=(\d{3})+(?!\d))', ',', parts[0])
return '.'.join(parts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment