How Do You Turn A List Of Strings Into A List Of Sublists With Each String In Each Sublist?
How do you turn a list of strings into a list of sublist of strings? For example: List_of_Strings = ['abc','def','ghi'] Desired Output: [['abc'],['def'],['ghi']] My hack to get
Solution 1:
You need to put those strings in []
there, and it's done.
>>> lis = ['abc','def','ghi']
>>> [[x] for x in lis]
[['abc'], ['def'], ['ghi']]
Post a Comment for "How Do You Turn A List Of Strings Into A List Of Sublists With Each String In Each Sublist?"