网页信息数据-数据分析(6)
2021-01-25 11:13
标签:request style 数据分析 user top des url json lxml 处理json数据 网页信息数据-数据分析(6) 标签:request style 数据分析 user top des url json lxml 原文地址:https://www.cnblogs.com/topass123/p/13236933.htmlimport urllib.request;
from bs4 import BeautifulSoup;
response = urllib.request.urlopen("file:///C:/Users/junwei_zhou/Desktop/502/6.1/html.html");
html = response.read();
html
soup = BeautifulSoup(html,"lxml");
soup
soup.find(‘tr‘);
soup.find_all(‘tr‘);
# -*- coding: utf-8 -*-
import json;
import urllib.request;
response = urllib.request.urlopen(‘file:///D:/PA//6.2//json.json‘);
jsonString = response.read();
jsonObject = json.loads(jsonString.decode())
jsonObject[‘employees‘]
jsonObject[‘employees‘][0]
jsonObject[‘employees‘][0][‘lastName‘]