costi_sourcepool.py 文件源码

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

项目:costi 作者: lawlrenz 项目源码 文件源码
def rm_source(identnr):
    """removes source with input identnr
    :param identnr:
    """
    source = get_sources(ident=str(identnr))
    if source:
        source_name = source[0][1]
    else:
        return False

    path = CACHE_DIR + str(identnr) + "_" + source_name.replace(".", "") + '.json'

    all_sources = _get_all_sources_as_list()
    new = [x for x in all_sources if x[0] != identnr]

    with open(SOURCE_FLE_NAME, 'w+') as csvfile:
        sourcewriter = csv.writer(csvfile, delimiter=DELIMITER, quoting=csv.QUOTE_ALL)
        for row in new:
            sourcewriter.writerow(row)

    if os.remove(path):
        return True
    else:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号