法1:
>>> "{:,}".format(56381779049)
'56,381,779,049'
>>> "{:,}".format(56381779049.1)
'56,381,779,049.1'
>>>
法2:
>>> import re
>>> subject = '1234567'
>>> result = re.sub(r"(?<=\d)(?=(?:\d\d\d)+$)", ",", subject)
>>> result
'1,234,567'
法3:
>>> import re
>>> subject = '1234567'
>>> result = re.sub(r"(\d)(?=(\d\d\d)+(?!\d))", r"\1,", subject)
>>> result
'1,234,567'