直接上干货: def ifTest(a,b): """return 返回一个结果就会退出,函数里只能执行一次return语句""" c=a-b if c>0: return 'a>b' return 'a<b....' 不用else,照样可以实现选择。