Computers/Language python

시간 측정

emzei 2012. 3. 14. 19:43

import time


time.clock() 이용하여 가능


ex. 시간재는 함수


def time_execution(code):

start = time.clock()

result = eval(code)

runtime = time.clock() - start


return result, runtime


'Computers > Language python' 카테고리의 다른 글

String vs. List vs. Dictionary  (0) 2012.03.14
hash function  (0) 2012.03.14
try / except  (0) 2012.03.14
list: pop  (0) 2012.03.14
index  (0) 2012.03.14