from ast import literal_eval as safe_eval string = '[[396, 555], [326, 337], [467, 332]]' print(safe_eval(string)) # will return: [[396, 555], [326, 337], [467, 332]]