pyhton之解析html的表格

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'jiangwenwen'

from bs4 import BeautifulSoup

html_doc = """"""

soup = BeautifulSoup(html_doc, 'html.parser')
for row in soup.findAll('table')[0].tbody.findAll('tr'):
    ipAddress = row.findAll('td')[1].get_text().split('(', 1)[0];
    print(ipAddress)

原文地址:https://www.cnblogs.com/jiangwenwen1/p/10928433.html