jsonD = json.dumps(htmlContent.text) converts the raw HTML content into a JSON
string representation. jsonL = json.loads(jsonD) parses the JSON string back into a
regular string/unicode object. This results in a no-op, as any escaping done by
dumps() is reverted by loads(). jsonL contains the same data as htmlContent.text.
Try to use json.dumps to generate your final JSON instead of building the JSON by
hand:
ContentUrl = json.dumps({
'url': str(urls),
'uid': str(uniqueID),
'page_content': htmlContent.text,
'date': finalDate
})
相关问题 更多 >
编程相关推荐