Python 进程共享变量

– Startweb 点击此处观看本系列配套视频。 进程有独立的内存 咱们先来看一个例子。服务器 from multiprocessing import Process x = 1 def my_task(): global x x += 1 # 在进程中修改 x print(f'x={x}') if __name__ == '__main__': p1
相关文章
相关标签/搜索