+ 1
concat a string to another string in Python
Hey there! Consider this string - - > mystring="1 2 23" and a shorter string - -> b="0" I need to concat b to every elements of mystring. note that mystring is a string not a list. so if i print the result, it would be: "01 02 023" What can i do?
1 Resposta
+ 1
a="1 2 23"
b="0"
c = " ".join(b+i for i in a.split())
print (c)