python 爬取td标签对应的值

[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

上一篇:如何使用Servlet,JSP和MySQL将文件上传到数据库


下一篇:TD配置不同分辨率流程