为了账号安全,请及时绑定邮箱和手机立即绑定

t=(t2-t1)*1000 if unit=='ms' else (t2 - t1)

 t=(t2-t1)*1000后面加的 if unit=='ms' else (t2 - t1)是什么意思

正在回答

1 回答

if unit=='ms:
    t=(t2-t1)*1000
else:
    t=t2-t1

或者:

t = unit=='ms'?(t2-t1)*1000:t2-t1


2 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
python进阶
  • 参与学习       255767    人
  • 解答问题       2946    个

学习函数式、模块和面向对象编程,掌握Python高级程序设计

进入课程

t=(t2-t1)*1000 if unit=='ms' else (t2 - t1)

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信