⚠️ multiprocessing.Manager.dict 使用注意

from multiprocessing import Manager

# 1 md
= Manager().dict() md['a'] = ['a'] if 'a' in md.keys(): a = md.get('a') a.append('b') md['a'] = a print(md)
# 2 md
= Manager().dict() md['a'] = ['a'] if 'a' in md.keys(): md['a'].append('b') print(md)

#1  {'a': ['a', 'b']}
#2  {'a': ['a']}

 

posted @ 2020-08-25 21:47  catyuang  阅读(620)  评论(2编辑  收藏  举报