逆波兰表达式求值 Evaluate Reverse Polish Notation - Python 以栈实现
classSolution:defevalRPN(self,tokens:List[str])->int:stack=[]foriintokens:ifiin{"+","-","*","/"}:last=stack.pop()first=stack.pop()#eval()将字符串表达式转化为正常表达式#f'{变量名}'允许动态更新字符串内容,最后返回字符串ans=int(eval(f'{firs