>>> 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
timer计算两个方法执行时间
猜你喜欢
转载自www.cnblogs.com/themost/p/9540369.html
今日推荐
周排行