utils.py 文件源码

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

项目:demo-day-vikings 作者: Mester 项目源码 文件源码
def get_genres(database_name):
    """Utility method to get all the genres as a set"""
    db = TinyDB(os.path.join(os.getcwd(), database_name))
    all_genres = { song['genre'] for song in db.all() }
    specific_genres = set()
    for genre in all_genres:
        specific_genres = specific_genres.union(set(genre.strip().split('/')))
    db.close()
    return _strip_spaces(specific_genres)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号