python - Remove square brackets from list -
i have list:
list1 = [['123'], ['456'], ['789']]
i want convert list string , later store column in database in form:
123 / 456 / 789
i tried doing this:
s2 = ", ".join(repr(e) e in list1) print(s2)
but i'm getting:
['123'], ['456'], ['789']
any ideas on should next desired output?
you close, want flatten list of lists first, convert string. this:
" / ".join([item sublist in list1 item in sublist])
Comments
Post a Comment