该语法类似 C 中的 B ? V1 : V2 在python的实现方式是 V1 if B else V2 够简洁 够优雅,该语法是在2.5版本加入的,使用时请考虑兼容性 转载于:https://www.cnblogs.com/kelvinkuo/p/3177372.html