python manager 实现线程资源共享
2016-07-05 22:31
381 查看
from multiprocessing import Process,Manager
def f(d,l):
d[0] = 0
d['2'] = 'hello world'
d['3'] = None
l.reverse()
if __name__ == '__main__':
manger = Manager()
#声明一个字典
d = manger.dict()
#声明一个列表
l = manger.list(range(10))
p = Process(target=f,args=(d,l,))
p.start()
p.join()
print d
print l
def f(d,l):
d[0] = 0
d['2'] = 'hello world'
d['3'] = None
l.reverse()
if __name__ == '__main__':
manger = Manager()
#声明一个字典
d = manger.dict()
#声明一个列表
l = manger.list(range(10))
p = Process(target=f,args=(d,l,))
p.start()
p.join()
print d
print l
相关文章推荐
- Python安装Pip出现的问题
- Python学习笔记7:Python字典和集合
- Ubantu下配置Sublime Text3---python环境的搭建
- Python学习笔记——基础
- Python 语言及其应用 Chapter_6_Note 3 Seek函数功能
- KL散度及其python实现
- 糗百的HTML更改后的python爬虫,2016,7,5 总计
- Python读写json文件
- Python3 Pickle报错 TypeError
- OBIEE权限管理-WLST脚本
- Python读取等宽数据文件
- python系列0
- [Python学习笔记]1——从零开始学Python
- python+Eclipse+pydev环境搭建
- Python IDLE reload(sys)后print无法正常执行命令的原因
- C/Python实现的一道笔试题
- Python读取Microsoft Excel文件
- Python查找第n个子串小技巧
- Python--内存管理
- python 2.7.10 找不到 libmysqlclient.18.dylib 解决方案