2
我已經寫了兩次,我看不到問題,我已經機械化安裝在python 2上,我沒有做標籤和空格,我只做空間。機械化瀏覽器沒有任何屬性
import urllib
from bs4 import BeautifulSoup
import re
import urlparse
import mechanize
url = "http://www.dailymail.co.uk/home/index.html"
br = mechanize.Browser()
br.open(url)
for link in br.links():
print link
,誤差
Traceback (most recent call last):
File "mechanize.py", line 4, in <module>
import mechanize
File "/home/ro/Autoblog/mechanize/mechanize.py", line 8, in <module>
br = mechanize.Browser()
AttributeError: 'module' object has no attribute 'Browser'
'/ home/ro/Autoblog/mechanize/mechanize.py'是'mechanize'的路徑,還是它映射到真實模塊? –
是的,這是問題,感謝您的幫助。 – booberz