storeProxy.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:searchForAll 作者: MemoryAndDream 项目源码 文件源码
def store(proxys):
    pidfile = open(proxyFilePath, "a")
    for i in range(10):
        try:
            fcntl.flock(pidfile, fcntl.LOCK_EX | fcntl.LOCK_NB)  # LOCK_EX ???:????????????????????????
            # LOCK_NB ????: ?????????????????????????????????????
            if type(proxys) == type([]):
                for proxy in proxys:
                    pidfile.write(proxy + '\n')
            else:
                pidfile.write(proxys + '\n')
            pidfile.close()
            break
        except:
            # print "another instance is running..."
            time.sleep(3)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号