1 """Random helpful functions for mevemon """
4 """Converts a number in the format 1234567 to 1,234,567
6 num_string = '%0.2f' % number
8 #a,b = num_string.split('.')
9 decimal_part, fractional_part = num_string.split('.')
11 while len(decimal_part) > 3:
12 thousands.insert(0, decimal_part[-3:])
13 decimal_part = decimal_part[0:-3]
15 thousands.insert(0, decimal_part)
17 if type(number) is int:
18 return ','.join(thousands)
20 return ','.join(thousands) + '.' + fractional_part