How to print an integer with commas; E.g., 3,056,789

Simon.Foster at smiths-aerospace.com Simon.Foster at smiths-aerospace.com
Thu Oct 17 06:13:49 EDT 2002


Ah here it is:

def commaise( s ):
    if len(s) <= 3: return s
    return commaise( s[:-3] ) + ',' + s[-3:]




More information about the Python-list mailing list