我想为我所有的Evernote笔记添加或编辑en-media标签中的高度和宽度值。这个想法是通过在呈现笔记时使图像显示为较小的图像来提高笔记的可读性,但使图像保持附加到笔记时的原始大小。
<en-media type="image/jpg" hash="a2a50c9d6aab3f1f19c9d001f771d942" height="200" width="200" />有没有python库,或者使用noteStore.getNote获得的编辑note.content的最佳方法是什么,然后大概可以使用noteStore.updateNote更新编辑过的笔记。
谢谢!
发布于 2020-08-28 23:18:29
下面
import xml.etree.ElementTree as ET
en_xml = '''<doc><en-media type="image/jpg" hash="a2a50c9d6aab3f1f19c9d001f771d942" height="200" width="200" /></doc>'''
new_height = '300'
new_width = '300'
root = ET.fromstring(en_xml)
media = root.find('.//en-media')
media.attrib['height'] = new_height
media.attrib['width'] = new_width
ET.dump(root)输出
<doc><en-media hash="a2a50c9d6aab3f1f19c9d001f771d942" height="300" type="image/jpg" width="300" /></doc>https://stackoverflow.com/questions/63635071
复制相似问题