Making a string out of a string and an integer in Python [duplicate] June 3, 2023 by Tarik name="b" + str(num) or name="b%s" % num Note that the second approach is deprecated in 3.x.