Python newbie question
How to concatenate strings in python like
Section = 'C_type'
Concatenate it with 'Sec_' to form the string :
Sec_C_type
Python newbie question
How to concatenate strings in python like
Section = 'C_type'
Concatenate it with 'Sec_' to form the string :
Sec_C_type
The easiest way would be
Section = 'Sec_' + Section
But for efficiency, see: http://www.skymind.com/~ocrow/python_string/
Use +
for string concatenation as:
section = 'C_type'
new_section = 'Sec_' + section
you can also do this:
section = "C_type"
new_section = "Sec_%s" % section
This allows you not only append, but also insert wherever in the string:
section = "C_type"
new_section = "Sec_%s_blah" % section