Python抓取与TD标记对应的值,python,爬取,td,标签

发表时间:2020-12-25

[root@yyjk /tmp]#cat a2.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import cookielib
import json
import httplib
import re
import requests
import StringIO
import time
from lxml import etree
s = requests.session()
print s.headers
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0'
}


data = {'username':'thinkgem','password':'R6k_5QTs'}
# data = urllib.urlencode(data)
response = s.post(login_url, data=data, headers=headers,timeout=10)

data={'pageNo':'1','pageSize':'100'}
fh2=open('fh2.html','r')
fh3=fh2.read()
htmlEmt=etree.HTML(fh3)
result= htmlEmt.xpath('//td')
fo

文章来源互联网,如有侵权,请联系管理员删除。邮箱:417803890@qq.com / QQ:417803890

微配音

Python Free

邮箱:417803890@qq.com
QQ:417803890

皖ICP备19001818号
© 2019 copyright www.pythonf.cn - All rights reserved

微信扫一扫关注公众号:

联系方式

Python Free