'입력'에 해당되는 글 1건

  1. 2013.12.18 [Python] 연습코딩, thread, timer, input, try


import threading, time


def hello():

        i = 0

        while i < 5:

                i = i + 1

                print("hello "+str(i))

                time.sleep(1.0)



inp = input("input time? ")

try:

        numInp = int(inp)

        print("input value : " + inp)

except ValueError:

        print("input value is not valid. \n default : 1")

        numInp = 1.0

t = threading.Timer(numInp, hello)

t.start()





Posted by tenn
,