utils.py 文件源码

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

项目:Daily_scripts 作者: x1ah 项目源码 文件源码
def migrate():
    """migrate data from database to json
    """
    conn = sqlite3.connect("CUMTB.db")
    res = conn.execute("SELECT * FROM CUMTB")
    data = res.fetchall()
    json_data = list()
    pool = Pool(cpu_count() * 2)
    def read_conf(lst):
        res = os.popen("./encrypt {0} {1}".format(*lst))
        _data = json.loads(res.readline())
        json_data.append(_data)
    pool.map(read_conf, data)
    pool.close()
    pool.join()
    with open("there_is_nothing.json", 'w') as f:
        json.dump(json_data, f, indent=2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号