元组做函数的参数 2023年1月21日13:29:52 用元组做参数,可以减数重复的逻辑代码 # -*- coding:utf8 -*- demo = u"你喜欢吃饭吗" # demo = u"你喜欢吃饭吗?" if demo.endswith((u"吗", u"?")): print("test") # 等价写法 if demo.endswith(u"吗") or demo.endswith(u"?"): print("test")