manipulating list of strings in python -
how can obtain expected result below?
data = ['abc', 'def', 'ghi'] expected result is:
[abc, def, ghi] my effort is:
ans = [', '.join([''.join(i) in data])] print ans ['abc, def, ghi']
try below code:
>>> ans = '[' + ', '.join([''.join(i) in data]) + ']' >>> ans '[abc, def, ghi]' >>> python
No comments:
Post a Comment