Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert string representation of a list to list

# Python code to demonstrate converting 
# string representation of list to list
# using ast.literal_eval()
import ast
  
# initializing string representation of a list
ini_list = "[1, 2, 3, 4, 5]"
  
# Converting string to list
res = ast.literal_eval(ini_list)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #convert #string #representation #list #list
ADD COMMENT
Topic
Name
5+9 =