我想玩多线程,所以我可以做得更好,但由于一些奇怪的原因,我的代码不想遵循命令。它假设进入while循环并打印,但它不会,并且也不会产生任何错误,所以哪些行是错误的?我在这个python脚本中犯了什么错误?
#!/usr/bin/env python
#
#
#
import random
import thread
import time
import sys
import os
def DisplayA(name,wait):
while True:
print 'Display: 1';time.sleep(wait)
def DisplayB(name,wait):
while True:
print 'Display: 2';time.sleep(wait)
def DisplayC(name,wait):
while True:
print 'Display: 3';time.sleep(wait)
thread.start_new_thread(DisplayA,('Display1',2))
thread.start_new_thread(DisplayB,('Display2',3))
thread.start_new_thread(DisplayC,('Display3',5))
这从我的终端正常工作...... ... –
你看到的输出是什么?一点都没有?另外,哪个版本的Python,在哪个操作系统上? –