-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
|
||
{ | ||
"name": "Python: 当前文件", | ||
"type": "python", | ||
"request": "launch", | ||
"pythonPath": "/usr/bin/python3", | ||
"program": "${file}", | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"editor.fontSize": 16, | ||
"debug.console.fontSize": 16, | ||
"terminal.integrated.fontSize": 16 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print('jj') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import urllib.request as urllib2 | ||
import | ||
|
||
|
||
# 构建一个CookieJar对象实例来保存cookie | ||
cookiejar = cookielib.CookieJar() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from multiprocessing import Pool | ||
from time import sleep,ctime | ||
|
||
def worker(msg): | ||
sleep(2) | ||
print(msg) | ||
return ctime() | ||
|
||
#创建进程池 | ||
pool = Pool(processes = 4) | ||
|
||
result = [] | ||
for i in range(10): | ||
msg = "hello %d"%i | ||
#将事件放入进程池队列,等待执行 | ||
r = pool.apply_async(func = worker,args = (msg,)) | ||
result.append(r) | ||
|
||
#关闭进程池 | ||
pool.close() | ||
|
||
#回收 | ||
pool.join() | ||
|
||
for i in result: | ||
print(i.get()) #获取事件函数的返回值 |
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