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']
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.