计算函用运行用时

import cProfile
import random
def f2(lIn):
    print("count run time")
lIn = [random.random() for i in range(100000)]
cProfile.run('f2(lIn)')
原文地址:https://www.cnblogs.com/vickey-wu/p/8605734.html