Python Forum
converting the items of a list in new lists - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: converting the items of a list in new lists (/thread-15331.html)



converting the items of a list in new lists - clarablanes - Jan-13-2019

Good morning friends,
I have the list1 (in a simplified way) that I need to convert to the list2. I can't find the way.
Could you help me, please?

list1 = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']


list2 = [[Monday],[Tuesday],[Wednesday],[Thursday],[Friday],[Saturday],[Sunday]]



RE: converting the items of a list in new lists - buran - Jan-13-2019

list2 = [[weekday] for weekday in list1]



RE: converting the items of a list in new lists - clarablanes - Jan-13-2019

It seems so easy this way...
Thank you very much!!