How to use timeit when timing a function

前端 未结 5 1790
南旧
南旧 2020-12-16 16:41

Let me start off by saying I know almost nothing about python but have to write a program in three different languages (already done in java and c++).

I need to be a

5条回答
  •  自闭症患者
    2020-12-16 17:23

    You could do something like this:

    import time
    
    start = time.time()
    A()
    end = time.time()
    print "Took %f ms" % ((end - start) * 1000.0)
    

提交回复
热议问题