life.py 文件源码

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

项目:yoda 作者: yoda-pa 项目源码 文件源码
def view_reading_list(opts):
    """
    get the current reading list
    :param opts:
    """
    if os.path.isfile(READING_LIST_ENTRY_FILE_PATH):
        with open(READING_LIST_ENTRY_FILE_PATH) as reading_list_entry:
            file_contents = yaml.load(reading_list_entry)
            file_contents = dict(file_contents)
            last_updated = time.ctime(os.path.getmtime(READING_LIST_ENTRY_FILE_PATH))
            query = opts[1]
            params = opts[0]
            search = ''

            if query != 'None':
                search = "(filtered by " + params + ": " + query + ")"
                filtered_contents = [article for article in file_contents['entries'] if
                                     is_in_params(params, query, article)]
                file_contents = dict(entries=filtered_contents)

            chalk.blue("Your awesome reading list " + search)
            chalk.blue("Last updated: " + last_updated)
            print_reading_list(file_contents)
    else:
        empty_list_prompt()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号