在csv文件和网站之间打印匹配值

时间:2016-12-05 22:07:55

标签: python python-2.7 web-scraping

我想将行[1](csv文件中的地址字段)与下面的网站相匹配。我希望Python在csv文件中搜索每个Address值,并返回与网站上的Address相关的任何数据。有可能吗?

import requests
import bs4
import csv

r = requests.get('https://etrakit.friscotexas.gov/Search/permit.aspx')

with open ('C:/Users/Pythoner/Addresses.csv') as f:
    for row in csv.reader(f):
        print row[1]

1 个答案:

答案 0 :(得分:0)

如果行[1]是您可以尝试的网址

import requests
import bs4
import csv

with open ('C:/Users/Pythoner/Addresses.csv') as f:
    for row in csv.reader(f):
        r = requests.get(row[1])
        print r.text

查看http://www.pythonforbeginners.com/requests/using-requests-in-python以获取有关如何使用“请求”库的帮助