我正在尝试编写一个脚本来搜索 digikey.com 的一部分并返回每个部分的价格中断。我在打开网址时遇到了麻烦。我查看了其他类似的脚本,这就是我想出的,但我收到 BeautifulSoup 错误。我正在使用 Python 2.7 并运行 Ubuntu 13.04。
#!/usr/bin/python
# This script will find the page of a part and return the price
# break information
import BeautifulSoup
import urllib2
# Create Url to read
Digikey_url = 'http://digikey.com/scripts/DkSearch/dksus.dll?Detail&name='
partNum = '458-1003-ND'
url=Digikey_url+partNum
# Create BeautifulSoup Object
page = urllib2.urlopen(url)
soup = BeautifulSoup(response)
# Close Page
page.close()
这是我得到的错误:
Traceback (most recent call last):
File "DigiKeyPrice.py", line 17, in <module>
soup = BeautifulSoup(page)
TypeError: 'module' object is not callable
我也是python的新手,但任何帮助将不胜感激。
谢谢