timeit

https://baijiahao.baidu.com/s?id=1671664364219061186&wfr=spider&for=pc

>>> timeit.timeit(stmt='10**4 in s',setup='s=range(10**5)', number=10**5)
0.006006000000070344


>>> timeit.timeit(stmt='10**4 in s',setup='s=set(range(10**5))', number=10**5)
0.0032372999999097374
posted @ 2023-11-16 23:31  chuangzhou  阅读(4)  评论(0编辑  收藏  举报