1import ast
2
3# initializing string representation of a list
4ini_list = "[1, 2, 3, 4, 5]"
5
6# Converting string to list
7res = ast.literal_eval(ini_list)
8
9# printing final result and its type
10print ("final list", res)
11print (type(res))