Convert Html to Json using Python
P粉262073176
P粉262073176 2023-08-18 12:05:43
0
1
587
<p>'I'm trying to find a way to convert HTML to JSON using Python, but I can't find an easy way and have to build my own, which doesn't make sense in large HTML. Can you help me? I've tried using Chat GPT but that didn't help so this is my last resort'</p>
P粉262073176
P粉262073176

reply all(1)
P粉590929392

Don't build your own HTML to JSON converter, use an existing converter, such as html-to-json.

Use pip install html-to-jsonAfter installation, add the following code to your code:

import html_to_json

html = "在这里放入你的HTML代码"
json = html_to_json.convert(html)
print(json)

The way htmlthe string is generated depends on the source of the HTML: it can be from a file, a URL, etc...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!