to string python code example Example 1: to str python >>> str(10) '10' >>> int('10') 10 Example 2: to string python x = 2.718 strX = str(x)