[출처 : http://drcarter.tistory.com/entry/python으로-중간-수행시간-구하기]


# -*- coding: ms949 -*-
from math import *
from datetime import *


def main():
    now1 = datetime.now()
    result = 0
    for i in range(1000000):
        result = result + pow(i,2)

    now2 = datetime.now()
    
    time = now2-now1
    print "결과 : ", result
    print "시간 : ", time
     
main()

+ Recent posts