Given n strings, the task is to merge all strings into a single list.
While developing an application, there come many scenarios when we need to operate on the string and convert it as some mutable data structure, say list. There are multiple ways we can convert strings into list based on the requirement. Let’s understand it better with help of examples.
Method #1: Using ast
['Geeks', 'for', 'Geeks', 'paras.j', 'jain.l', 'i', 'n', 'd', 'i', 'a']
Method #2: Using eval
['Geeks', 'for', 'Geeks', 'paras.j', 'jain.l', 'india']
['Geeks', 'for', 'Geeks121', '142extend', 'India']
- Python | Ways to sum list of lists and return sum list
- Python | Merge list elements
- Python | Merge two list of lists according to first element
- Python | Merge two lists into list of tuples
- Python | Remove empty strings from list of strings
- Python | Tokenizing strings in list of strings
- Python | Convert list of strings to list of tuples
- Python | Convert list of tuples to list of strings
- Different ways to clear a list in Python
- Python | Ways to rotate a list
- Python | Ways to Spilt the list by some value
- Python | Ways to flatten a 2D list
- Python | Ways to shuffle a list
- Extending a list in Python (5 different ways)
- Python | Ways to find indices of value in list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.