Since Python\'s string can\'t be changed, I was wondering how to concatenate a string more efficiently?
string
I can write like it:
s += string
In Python >= 3.6, the new f-string is an efficient way to concatenate a string.
>>> name = 'some_name' >>> number = 123 >>> >>> f'Name is {name} and the number is {number}.' 'Name is some_name and the number is 123.'