摘要:
>>> 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 阅读全文
摘要:
>>> x = 1 >>> y = 2 >>> assert x == y, "not equals" Traceback (most recent call last): File "", line 1, in assert x == y, "not equals" AssertionError: not equals >>> 阅读全文