Skip to content

Instantly share code, notes, and snippets.

@alaudet
Last active August 29, 2015 14:02
Show Gist options
  • Save alaudet/c2acb6618b60d10f1276 to your computer and use it in GitHub Desktop.
Save alaudet/c2acb6618b60d10f1276 to your computer and use it in GitHub Desktop.
Decimal output
import decimal
number = float(1.787654)
decimal.getcontext().prec = 2
dec_number = decimal.Decimal(number) * 1
print str(dec_number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment