[Solved] Use a formatted string to separate groups of digits
This is one way to achieve what you are looking to do: number = “12345678910” print( ‘number id {0}.{1}.{2}-{3}’.format( *[number[i:i+3] for i in range(0,len(number), 3)] ) ) #number id 123.456.789-10. There are a few problems with your code. First the first number in the “{0…}” refers to the positional argument in the format() function. In … Read more