我有这段代码,在这段代码中,我从 url(ajax) 获取了一个 json 对象,我需要获取内部数据,这是我的代码:
url = URL_BASE9
req = requests.get(url)
statusCode = req.status_code
if statusCode == 200:
html = BeautifulSoup(req.text, "html.parser")
#print(html)
这是我的结果
`{'FiltroFechaInicio': '/Date(-62135586000000)/', 'Pagina': 1, 'ListHechos':
[{'contenido': '<div class="ExternalClass3DB02CFE22F84F3F998EBEA913E5A79B">
<div><a
href="/Noticiascibe/hechos%20esenciales/NAVIERA/hes_2017060105740.pdf">
hes_2017
060105740.pdf</a></div></div>', 'Activo': None, 'FechaString': '15-06-
2017',
'TipoAdjunto': None, 'UrlAdjunto':
'/Noticiascibe/hechos%20esenciales/NAVIERA/hes_2017060105740.pdf',
'Descripcion': None, 'UrlImagen': None, 'ClaseIconoAdjunto':
'iconoDescargaPDF', 'Fecha': '/Date(1497566727000)/'}`
如何获取数据的内容,谢谢,祝你有美好的一天
它与字典相同,每个键都有一个键和值
my_dict = {
'key1': 'value1',
'key2': 'value2',
'key3': 'value3'
}
my_dict['key1']
# Out: 'value1'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句