Jul-06-2020, 01:07 PM
(This post was last modified: Jul-06-2020, 01:09 PM by chesschaser.)
Hi guys! I have this list:
I have tried a number of different functions in place of str.split however none worked.
Please help
mylist = ["Hello", ["Hello2", "Hello3"], "Hello4"]However, I want the list to be this instead (don't say just remove the sublist. This is not the real list. Just a test list. The real list comes from a function return so that wouldn't work):
mylist = ["Hello", "Hello2", "Hello3", "Hello4"]I have tried this:
sum(map(str.split, sum([[k] if isinstance(k, str) else k for k in single_list1], [])), [])However this will not work as the real list has spaces and this splits them into different list items too which I do not want.
I have tried a number of different functions in place of str.split however none worked.
Please help