2016-11-19 2 views
0

learing 테스트 프로그램을 작성하는 동안 TypeError가 발생했습니다. 며칠TypeError : __init __() missing 2 개의 필수 위치 인수 : 'selfClosingTags'및 'isHTML'

를이 얼마나 나는 또한 설치

TypeError: __init__() missing 2 required positional arguments: 'selfClosingTags' and 'isHTML' 

타사 라이브러리, 나도 몰라, 그리고 혼란 :

from bs4 import BeautifulSoup 

newurl = 'http://susumr.cc/' 
soup = BeautifulSoup(newurl,'lxml') 
print(soup.text) 

나는이 오류가 발생했습니다 : 여기

코드입니다

답변

0

URL이 아닌 BeautifulSoup 생성자에 HTML 문자열을 전달해야합니다.

import urllib 

from bs4 import BeautifulSoup 

newurl = 'http://susumr.cc/' 
content = urllib.urlopen(newurl).read() # Retrive url content 
soup = BeautifulSoup(content, 'lxml') # pass the content to `BeautifulSoup` constructor 
print(soup.text) 
관련 문제