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)]"
How about using ast.literal_eval:
ast.literal_eval
import ast def convertor(string): return ast.literal_eval(string) string1 = "[(694, 104), (153, 236), (201, 106), (601, 427)]" print(convertor(string1))