93
Python练习(day9)-沐梓琼-51CTO博客
source link: http://blog.51cto.com/10630401/2069958
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
练习1、模拟抢车票(进程同步锁)代码1:(并发运行,效率高,但竞争同一文件,数据写入错乱)frommultiprocessingimportProcessimporttime,json,randomdefsearch():dic=json.load(open('db.txt'))print('剩余票数%s'%dic['count'])defget():dic=json.load(open('db.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK