Friday, 15 March 2013

python - Concatenation of items in list -



python - Concatenation of items in list -

i have such list:

['s/m - black', ' 93094-01']

it result of:

m['value'].split(',')[0:2:]

how can produce such string it:

's/m - black, 93094-01'

i have tried:

print [i + ', ' + in m['value'].split(', ')[0:2:]]

but gives me:

['s/m - black, s/m - black', ' 93094-01, 93094-01']

you should utilize bring together method:

",".join(m['value'].split(', ')[0:2:])

python string text concatenation string-concatenation

No comments:

Post a Comment