Python。什么是更快[关闭]

问题描述 投票:-5回答:1

例如,如果我必须在循环内更改标志状态。

condition1 = True
while True:
    'do something'
    if condition1 is True:
        condition1 = Fale

or

while True:
    'do something'
    condition1 = Fale

哪种方法更好?

python cpu-usage flags
1个回答
0
投票

您可以参考此How to use timeit module

© www.soinside.com 2019 - 2024. All rights reserved.