How to concatenate strings in python?
For example:
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: https://waymoot.org/home/python_string/
More efficient ways of concatenating strings are:
join():
Very efficent, but a bit hard to read.
>>> Section = 'C_type'
>>> new_str = ''.join(['Sec_', Section]) # inserting a list of strings
>>> print new_str
>>> 'Sec_C_type'
String formatting:
Easy to read and in most cases faster than '+' concatenating
>>> Section = 'C_type'
>>> print 'Sec_%s' % Section
>>> 'Sec_C_type'