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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -