Some times, we come over the data that is in string format in a list and it is required to convert it into a list of the list. This kind of problem of converting a list of strings to nested list is quite common in web development. Let’s discuss certain ways in which this can be performed.
Method #1: Using iteration
[[‘Geeeks’, ‘Forgeeks’], [‘65.7492’, ‘62.5405’], [‘Geeks’, ‘123’], [‘555.7492’, ‘152.5406’]]
Method #2 : Using
ast [list with numeric values]
[[12, 454], [15.72, 82.85], [52.236, 25256], [95.9492, 72.906]]
- Python | Convert a nested list into a flat list
- Python | Convert list of nested dictionary into Pandas dataframe
- Python | Check if a nested list is a subset of another nested list
- Python | Find maximum length sub-list in a nested list
- Python | Pair and combine nested list to tuple list
- Python | Convert list of string to list of list
- Python | Convert list of tuples to list of list
- Python | Convert list of string into sorted list of integer
- Python | Convert list of numerical string to list of Integers
- Python | Convert a string representation of list into list
- Python | Convert list of tuples to list of strings
- Python | Convert string enclosed list to list
- Python | Convert 1D list to 2D list of variable length
- Python | Convert list of strings to list of tuples
- Python | Convert list into list of lists
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.
Improved By : mayank5326