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)

posted @ 2019-05-27 00:03  姜文文  阅读(1170)  评论(0编辑  收藏  举报