Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created May 6, 2015 19:37
Show Gist options
  • Save c0ldlimit/1ed013ea85bfdfa55669 to your computer and use it in GitHub Desktop.
Save c0ldlimit/1ed013ea85bfdfa55669 to your computer and use it in GitHub Desktop.
#python formatting floats in python without superfluous zeros
#http://stackoverflow.com/questions/2440692/formatting-floats-in-python-without-superfluous-zeros
#https://docs.python.org/2/library/string.html#format-specification-mini-language
'{0:g}'.format(3.140)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment