2015. 5. 8. 05:16
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

import threading
import time

class AsyncWrite(threading.Thread):
    def __init__(self, text, out):
        threading.Thread.__init__(self)
        self.text=text
        self.out=out

    def run(self):
        f=open(self.out,"a")
        f.write(self.text+'\n')
        f.close()
        time.sleep(2)
        print ("Finished Background file write to "+ self.out)


def Main():
    message=input("Enter a string to store:")
    background=AsyncWrite(message, 'out.txt')
    background.start()
    print ("The program can continue to run while it write in another thread")
    print (100+400)

    background.join()
    print("Waited until thread was complete")

if __name__=='__main__':
    Main()



'Python > Python 3.x' 카테고리의 다른 글

How do I execute a program from python? os.system fails due to spaces in path  (0) 2015.09.23
timer_with_Lock.py  (0) 2015.05.08
threading  (0) 2015.05.08
unixCommand.py  (0) 2015.04.03
wirteObject.py  (0) 2015.03.08
Posted by af334