Let's say I have something like this in a file:
[[(A,B), (B,C)],[(x,y), (z,v)]]
I want this as a python list of lists. How do I do that?
In the end, I would like to be able to iterate through the rows and the columns of this array, and get each pair of adjacent values to compare them.
ast.literal_evaldepending on whatA,B,C, ... look like.[[('A','B'), ('B','C')],[('x','y'), ('z','v')]]? Or do you have values for A,B,C...?eval. I'd prefer using a parser(maybe evenast.parse, or, as mgilson proposed,ast.literal_evalif those letters represent literals).