Python:删除标记并替换json fi中的\u00a0

2024-04-24 08:46:24 发布

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

我有这样的json文件:

[
    {
       "content": ["<p style=\"text-align:justify;\"> This is content1</p>"],
       "title" : ["This is\u00a0title 1"]
    },
    {
       "content": ["<p style=\"text-align:justify;\"> This is content2</p>"],
       "title" : ["This is\u00a0title 2"]
    }
]

我希望我的json是这样的:

^{pr2}$

我要删除HTML标记并将\u00a0替换为“”。 怎么做?在


Tags: 文件textjsontitleisstylehtmlcontent
1条回答
网友
1楼 · 发布于 2024-04-24 08:46:24

从Python^{} module开始。这将允许您在Python数据结构中读写JSON字符串。然后使用普通的Python工具来处理数据。在

要处理HTML,请查看Beautiful Soup。在

相关问题 更多 >