使用正则表达式替换“{}”“[]”为“()”,再使用python的eval()函数

import re

s = re.sub("({|\[|\]|})", lambda x: "(" if x.group() in "{[" else ")", input())
print(int(eval(s)))