Python的ENML转换为纯文本工具

2024-05-12 14:36:11 发布

您现在位置:Python中文网/ 问答频道 /正文

javascript中的端口enml库(英语.js)

ENML.PlainTextOfENML对于evernotesdkjs对我很好 我想为Python找到这个工具的好端口。在

我试图使用这些库,但出现了一个错误:

https://github.com/CarlLee/ENML_PY
ImportError:没有名为bs4的模块

https://github.com/wanasit/enml-py
2013年2月,没有文件,
ImportError:没有名为internals的模块

例如
我想要:

any sort of liquid damage to an Apple product will void your warranty.

^{pr2}$

我要在其中使用enml的代码部分:
视图.py在

title_contents = {}
for note in result_list.notes:
    content = note_store.getNoteContent(auth_token, 
                                        note_store.getNote(note.guid, 
                                        True,False, False, False).guid)
    title_contents[note.title] = content

enter code herereturn render_to_response('oauth/callback.html', {'notebooks': notebooks, 
                                                  'result_list': result_list, 
                                                  'title_contents': title_contents})

在回叫.html在

    .....
    <ul>
      {% for title, content in title_contents.items %}
        <li><b>{{ title }}</b><br>{{ content }}</li>
      {% endfor %}
    </ul>

Tags: 模块端口httpsgithubcomfalsetitlecontents
1条回答
网友
1楼 · 发布于 2024-05-12 14:36:11

这种组合完成了所有需要的事情:

from fenml import ENMLToHTML
# the fenml.py is my internal fork of the 
# https://github.com/CarlLee/ENML_PY/blob/master/__init__.py 
# with slightly modified code. 
from bs4 import BeautifulSoup
import html2text
....
title_contents[note.title] = html2text.html2text(BeautifulSoup(ENMLToHTML(content)).prettify())

相关问题 更多 >