リストがあります:
l = ['abc,def,ghi,jkl']
abc, def, ghi,jkl
ここで、 Pythonを使用して結果を別の要素としてフォーマットする必要があります。
それ、どうやったら出来るの?
他のことを試してみましたが、「a」、「b」、「c」などの結果が得られます。
前もって感謝します。
分割機能を使用:
res = 'abc,def,ghi,jkl'.split(',')
または:
l = ['abc,def,ghi,jkl']
output = []
for row in l:
output.extend(row.split(','))
# output will contain all the separate items for all items of l if more than one
print output
あなたが望む結果が正確にわからない:
>>> l = ['abc,def,ghi,jkl']
>>> l[0]
'abc,def,ghi,jkl'
>>> l[0].split(',')
['abc', 'def', 'ghi', 'jkl']
>>> ', '.join(l[0].split(','))
'abc, def, ghi, jkl'