pleae help how to start coding to concantenate strings that contains numbers and string

Recommended Answers

Do you want to know how to concatenate a string and an integer using +? If so: by converting the integer to a string first. That might look like this:

s = "foo"
x = 42
foo42 = s + str(x)

That said using format

Jump to Post

All 2 Replies

Do you want to know how to concatenate a string and an integer using +? If so: by converting the integer to a string first. That might look like this:

s = "foo"
x = 42
foo42 = s + str(x)

That said using format might be better than using + here:

"foo{}".format(x)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.