i have a string
like this
sample="[2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50]"
how do i convert that to list
? I am expecting the output to be list, like this
output=[2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50]
I am aware of split()
function but in this case if i use
sample.split(',')
it will take in the [
and ]
symbols. Is there any easy way to do it?
EDIT Sorry for the duplicate post..I didn't see this post until now Converting a string that represents a list, into an actual list object