>>> from timeit import Timer
>>> Timer("temp = x; x = y; y = temp", "x = 2; y = 3").timeit()
0.04535215532074004
>>> Timer("x, y = y, x", "x = 2; y = 3").timeit()
0.06476211600816484

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2021-08-10
  • 2021-12-15
  • 2022-12-23
猜你喜欢
  • 2021-12-07
  • 2021-12-27
  • 2021-12-27
  • 2021-09-12
  • 2022-12-23
  • 2021-12-27
  • 2022-01-08
相关资源
相似解决方案