I have a text file named datapolygon.txt, containing:
Polygon In
[(2,0),(3,0),(3,-2),(2,-2)]
[(3,0),(4,0),(4,-2),(3,-2)]
I want to assign that text value to a two dimensional list (list of lists). the result should be something like this :
polygonIn = [[(2,0),(3,0),(3,-2),(2,-2)],[(3,0),(4,0),(4,-2),(3,-2)]]
is there any simple way to achieve that other than to get through some complicated loop and check every substring and index then convert it to int and make it a tuple then assign it to variable polygonIn one by one using nested loops ?