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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -