1. 首页
  2. Python

python格式化html中的json字符串

&quot转换成json

部分json格式不规范,可以格式化处理,在转化成dict

示例

 

9578e511922f8a55d6be79983a2df60d

格式化输出

import html

publish_info_new_json = json.loads(html.unescape(publish_info_new))
publish_info_new_json
#publish_title = publish_info_new_json.get("title")

python格式化html中的json字符串

 

参考

[How do I perform HTML decoding/encoding using Python/Django? – Stack Overflow](https://stackoverflow.com/questions/275174/how-do-i-perform-html-decoding-encoding-using-python-django)

 

 

 

发表评论

登录后才能评论