I want to join the foll:
col = ('NS', 2013L)
to get:
'NS_2013'
I am doing this:
'_'.join(str(col)), and I get this: "(_'_N_S_'_,_ _2_0_1_3_L_)"
I want to join the foll:
col = ('NS', 2013L)
to get:
'NS_2013'
I am doing this:
'_'.join(str(col)), and I get this: "(_'_N_S_'_,_ _2_0_1_3_L_)"
You need to use string formatting.
>>> col = ('NS', 2013L)
>>> '{}_{}'.format(col[0], col[1])
'NS_2013'
The mistake you are making is in applying the str
invocation to the entire col
tuple rather than the elements of col
:
col = ('NS', 2013L)
'_'.join(str(element) for element in col)
yields:
'NS_2013"
which I believe is what you are after.