Skip to content

Instantly share code, notes, and snippets.

View Supernoob2017's full-sized avatar

Jake Supernoob2017

View GitHub Profile
@gabrii
gabrii / format_number.py
Created October 29, 2013 18:21
Pyhton number formating
# Original code from: http://stackoverflow.com/questions/5807952/removing-trailing-zeros-in-python
import decimal
import random
def format_number(num):
try:
dec = decimal.Decimal(num)
except:
return 'bad'
tup = dec.as_tuple()