题解 | #四则运算#
四则运算
http://www.nowcoder.com/practice/9999764a61484d819056f807d2a91f1e
#!/usr/sbin/python # -*- coding: utf-8 -*- ''' 输入一个表达式(用字符串表示),求这个表达式的值。 ''' while True: try: str_input = input() str_input = str_input.replace("{","(") str_input = str_input.replace("}",")") str_input = str_input.replace("[","(") str_input = str_input.replace("]",")") print(int(eval(str_input))) except: break