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

本站现有博文335篇,共被浏览937528

本站已经建立2648天!

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