Last active
August 29, 2015 14:01
-
-
Save kanazux/f21781b59fa3e412ee58 to your computer and use it in GitHub Desktop.
threads no comment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/local/bin/python | |
# -*- coding: utf-8 -*- | |
import threading | |
import time | |
class process_one(threading.Thread): | |
def __init__(self, name, number): | |
threading.Thread.__init__(self) | |
self.name = name | |
self.number = number | |
def run(self): | |
for item in range(5): | |
print "{}\t{}".format(self.name,self.number) | |
time.sleep(2) | |
one = process_one('one', 1) | |
one.start() | |
def process_two(name, number): | |
for item in range(10): | |
print "{}\t{}".format(name,number) | |
time.sleep(1) | |
two = threading.Thread(target=process_two, args = ['two', 2]) | |
two.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment