I have a string that looks like this:
arr = "[[[234],[432], ..., [523]]]"
I want to extract the array in this string so that it becomes:
arr = [[[234], [432], ..., [523]]]
how do I go about doing this?
I have a string that looks like this:
arr = "[[[234],[432], ..., [523]]]"
I want to extract the array in this string so that it becomes:
arr = [[[234], [432], ..., [523]]]
how do I go about doing this?
Keeping away from dangers of eval you can use literal_eval
ast.literal_eval("[[[234],[432],[523]]]") #[[[234], [432], [523]]]
Try eval()
function of python.
>>> arr=eval("[[[234],[432],[523]]]")
>>> arr
[[[234], [432], [523]]]