Skip to content

Instantly share code, notes, and snippets.

@vincentchu
Created July 28, 2011 17:47
Show Gist options
  • Save vincentchu/1112086 to your computer and use it in GitHub Desktop.
Save vincentchu/1112086 to your computer and use it in GitHub Desktop.
>>> num = 5.0/3
>>> print "num = %.2f" % (num)
num = 1.67
>>> print "num = %.3f" % (num)
num = 1.667
>>> print "num = %6.3e" % (num)
num = 1.667e+00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment