I have this list:
list1 = [['123'], ['456'], ['789']]
I want to convert this list into a string and later store it into a column in a database in this form:
123 / 456 / 789
I tried doing this:
s2 = ", ".join(repr(e) for e in list1)
print(s2)
But this is what I'm getting:
['123'], ['456'], ['789']
Any ideas on what should I do next to get the desired output?
Best Answer
You are close, but what you want to do is flatten your list of lists first, then convert to string. Like this: