Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从csv中的行导入美化组的URL_Python_Beautifulsoup_Screen Scraping - Fatal编程技术网

Python 从csv中的行导入美化组的URL

Python 从csv中的行导入美化组的URL,python,beautifulsoup,screen-scraping,Python,Beautifulsoup,Screen Scraping,我希望从file.csv中的行导入URL,以便beautiful soup可以解析XML,但我不知道如何实现以下操作 url=file.csv中的行 soup=BeautifulSoup(urlib2.urlopen('url').read() 字母=汤。选择('h1') 打印字母使用: 如果您有一个现有的input.csv文件,并且每行的第一个“单元格”中都有一个URL,则此代码将按原样工作,例如: https://google.com,some_other_data,1 https://s

我希望从file.csv中的行导入URL,以便beautiful soup可以解析XML,但我不知道如何实现以下操作

url=file.csv中的行
soup=BeautifulSoup(urlib2.urlopen('url').read()
字母=汤。选择('h1')
打印字母
使用:

如果您有一个现有的
input.csv
文件,并且每行的第一个“单元格”中都有一个URL,则此代码将按原样工作,例如:

https://google.com,some_other_data,1
https://stackoverflow.com,some_other_data,1

您是否在询问如何读取csv文件?
https://google.com,some_other_data,1
https://stackoverflow.com,some_other_data,1