책예제 보고 따라하는데 오류가 나는데 왜그런지 좀 알려주세요.ㅠ
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://en.wikipedia.org/wiki/kevin_bacon")
bs0bj = BeautifulSoup(html, "html.parser")
for link in bs0bj.findall("a"):
if 'href' in link.attrs:
print(link.attrs['href'])
책 왼쪽 페이지에 있는 소스를 쳐서 run 시켜보앗는데 , 저런 오류가 나옵니다. 소스가 완성형이 아니어서 그런거 같긴 한데 , 그렇다 이렇다 설명이 책에 없어서 , 따라해도 오류가 생기면 , 이해가 잘 안되서 넘 어렵네요..ㅠㅠ 왜 저런 오류가 뜨는지 가르쳐주세용 ㅠ
Traceback (most recent call last):
File "C:\Users\Administrator\eclipse-workspace\HelloWorld\crow4.py", line 4, in <module>
html = urlopen("http://en.wikipedia.org/wiki/kevin_bacon")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 564, in error
result = self._call_chain(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 756, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 564, in error
result = self._call_chain(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 756, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 570, in error
return self._call_chain(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
이 오류의 뜻만이라도 좀 가르쳐주시면 ㄳㄳ ㅠ
책 한페이지 넘어가기가 정말 힘드네요 휴;;
댓글 7개
크롤링보다도 파이썬 다른 입문서 먼저 보시는 게 더 나을 것 같네요.
두번정도 소설책 읽듯이 읽은후 예제를 직접 따라하면 무척 쉽게 진행 될 수 있습니다.
mairoo 님 말씀처럼 입문서 먼저 추천드려요~
제가 볼땐 404에러.. 페이지가 없어서 나는 오류같아 보이네요.
링크 들어가보니 페이지는 있는데.. 제 생각엔 urlopen 함수 주소넣는부분을 다시 한번 점검해 보시면 좋을것같아요~
게시판 목록
토크
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3270 | 11년 전 | 2677 | ||
| 3269 | 11년 전 | 1843 | ||
| 3268 | 11년 전 | 2285 | ||
| 3267 |
kiplayer
|
11년 전 | 1788 | |
| 3266 |
초심의설렘
|
11년 전 | 3003 | |
| 3265 | 11년 전 | 1816 | ||
| 3264 | 11년 전 | 1704 | ||
| 3263 | 9년 전 | 654 | ||
| 3262 |
커네드커네드
|
9년 전 | 623 | |
| 3261 | 9년 전 | 704 | ||
| 3260 | 9년 전 | 734 | ||
| 3259 |
|
9년 전 | 1151 | |
| 3258 | 9년 전 | 2883 | ||
| 3257 | 9년 전 | 1160 | ||
| 3256 | 9년 전 | 875 | ||
| 3255 |
star3840
|
9년 전 | 611 | |
| 3254 | 9년 전 | 605 | ||
| 3253 | 9년 전 | 805 | ||
| 3252 | 9년 전 | 893 | ||
| 3251 | 9년 전 | 685 | ||
| 3250 | 9년 전 | 706 | ||
| 3249 | 9년 전 | 840 | ||
| 3248 | 9년 전 | 1508 | ||
| 3247 | 9년 전 | 3149 | ||
| 3246 | 9년 전 | 1353 | ||
| 3245 |
|
9년 전 | 1422 | |
| 3244 | 9년 전 | 1333 | ||
| 3243 | 9년 전 | 788 | ||
| 3242 | 9년 전 | 1424 | ||
| 3241 | 9년 전 | 832 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기