python convert integer to specific format code example Example 1: how to convert to string in python str(integer_value) Example 2: python integer to string format '{:d}'.format(42)