EADST

Extract Webpage Information with Python

Here is the python program to extract webpage information with BeautifulSoup and save the data in a CSV file.

from bs4 import BeautifulSoup
import urllib.request
import pandas as pd

url = 'file:///Users/xd/Desktop/ieee/Region_5_Student_Branch_Counselors_and_Chairs.htm'
save_file = 'ieee_info_1'
html = urllib.request.urlopen(url).read()

soup = BeautifulSoup(html, "html.parser")

universities = soup.find_all('div', class_='spoName bullet pad-t15')
people = soup.find_all('div', class_='roster-results')

for u, p in zip(universities, people):
    info = p.find_all('p')
    university = u.get_text()
    name = info[0].get_text()
    if name == 'Position Vacant':
        continue
    title = info[2].get_text()
    address = info[3].get_text() + ', ' + info[4].get_text()
    email = info[-1].get_text()[7:]

    content = [[university, name, title, address, email]]
    list_name = ['university', 'name', 'title', 'address', 'email']
    data = pd.DataFrame(columns=list_name, data=content)
    data.to_csv("{}.csv".format(save_file), mode='a', index=False, header=False, encoding='utf-8')
About Me
XD
Goals determine what you are going to be.
Category
标签云
Datetime git-lfs GoogLeNet TSV TensorRT IndexTTS2 Mixtral ms-swift LLAMA PyCharm JSON Paddle Clash FlashAttention DeepStream HuggingFace Jupyter Qwen2.5 CTC Gemma Linux Website 音频 FP16 Numpy 论文速读 Ubuntu GPT4 图标 Bitcoin 关于博主 GGML Tiktoken Magnet 递归学习法 Tensor 顶会 MD5 Pytorch Plate torchinfo InvalidArgumentError NameSilo Bin Sklearn Pillow Animate CV Use SQL VPN Permission Web NLP HaggingFace Rebuttal ChatGPT git QWEN Django Llama SQLite tar Docker mmap Math News 公式 Translation Template Vim Git UI 算法题 transformers Shortcut EXCEL Anaconda llama.cpp Review WAN Windows Diagram Dataset Disk 图形思考法 BeautifulSoup Transformers ONNX VGG-16 财报 NLTK 搞笑 PyTorch CUDA Food v0.dev Augmentation Qwen2 YOLO CAM LaTeX CSV TTS Streamlit CEIR PIP Vmess FP64 Hotel Card Proxy ResNet-50 Baidu XML Bert 云服务器 Michelin UNIX FP32 Logo Interview Conda DeepSeek 版权 v2ray Land Ptyhon RL TensorFlow RGB Quantization Base64 Distillation 第一性原理 Knowledge Pickle Safetensors Image2Text Pandas Data Input Random 报税 Quantize 继承 SAM Cloudreve Agent tqdm Heatmap Hungarian BTC AI 论文 LLM XGBoost Domain LoRA hf C++ 强化学习 腾讯云 Github Tracking FastAPI 证件照 BF16 FP8 CC Miniforge logger Video 多线程 COCO 阿里云 API Crawler 净利润 OCR printf Freesound Search Statistics Markdown SVR Qwen Nginx OpenCV Algorithm LeetCode PDB 多进程 Color SPIE Bipartite Password Paper OpenAI GIT ModelScope Hilton VSCode PDF Attention Jetson Firewall 飞书 uwsgi diffusers Excel scipy WebCrawler 域名 Claude CLAP uWSGI Plotly RAR GPTQ 签证 Breakpoint Python icon Zip Google
站点统计

本站现有博文333篇,共被浏览922496

本站已经建立2628天!

热门文章
文章归档
回到顶部