time_start=time.time()
data=[]
for i in range(30):
print('request movie:',i)
_thread.start_new_thread(get_content,(i,))
input('press ENTER to exit...\n')
运行结果是这样的:
request movie: 0
request movie: 1
request movie: 2
request movie: 3
request movie: 4
request movie: 5
request movie: 6
request movie: 7
request movie: 8
request movie: 9
request movie: 10
request movie: 11
request movie: 12
request movie: 13
request movie: 14
request movie: 15
request movie: 16
request movie: 17
request movie: 18
request movie: 19
request movie: 20
request movie: 21
request movie: 22
request movie: 23
request movie: 24
request movie: 25
request movie: 26
request movie: 27
request movie: 28
request movie: 29
press ENTER to exit...
Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by Unhandled exception in thread started by 63162021290Unhandled exception in thread started by 8Unhandled exception in thread started by Unhandled exception in thread started by 177Unhandled exception in thread started by 12224Unhandled exception in thread started by Unhandled exception in thread started by 2
>>> <function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810><function get_content at 0x062F8810> <function get_content at 0x062F8810> <function get_content at 0x062F8810><function get_content at 0x062F8810> <function get_content at 0x062F8810> <function get_content at 0x062F8810><function get_content at 0x062F8810>
Traceback (most recent call last):
Traceback (most recent call last):
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
data:data:data:data:data:data:data: File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
data: File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
data:data: File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
data:data:data: File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
File "D:\Program Files(X)\Python\个人文件\lesson74.py", line 6, in get_content
data: 1414141414141414d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()1414d=urllib.request.urlopen(url).read()141414d=urllib.request.urlopen(url).read()d=urllib.request.urlopen(url).read()14
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
File "D:\Program Files(X)\Python\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout) return opener.open(url, data, timeout) return opener.open(url, data, timeout)return opener.open(url, data, timeout)return opener.open(url, data, timeout)
return opener.open(url, data, timeout) return opener.open(url, data, timeout)return opener.open(url, data, timeout)
return opener.open(url, data, timeout)return opener.open(url, data, timeout)return opener.open(url, data, timeout)