Multi-threading Help? 01-24-2015, 04:36 PM
#1
Code:
import string, random
from random import randint
def id_generator(size=6, chars=string.ascii_uppercase):
return ''.join(random.choice(chars) for _ in range(size))
def random_no(n):
range_start = 10**(n-1)
range_end = (10**n)-1
return randint(range_start, range_end)
f = open('list.txt', 'r+')
def gen():
s = str(str(id_generator()) + str(random_no(2)) + 'c')
if not s in f.readlines():
print(s)
f.write(s + '\n')
while True:
gen()How would I implement multi-threading in the example above? Say, two threads running simultaneously.
















![[+]](https://sinister.li/images/modern/collapse_collapsed.png)



