python format number integer code example Example 1: print python format '{} {}'.format('one', 'two') Example 2: python integer to string format '{:d}'.format(42)