write a function which takes a string in the format given returns a list in given below format
input: "[(694, 104), (153, 236), (201, 106), (601, 427)]"
You can use ast.literal_eval
import ast arr = ast.literal_eval("[(694, 104), (153, 236), (201, 106), (601, 427)]") for ele in arr: print(ele)
Output
(694, 104) (153, 236) (201, 106) (601, 427)