0
BeautifulSoup 4를 사용하려고했습니다. 성공적으로 설치 한 후에는 항상 약간의 오류가 있으며 "soup = BeautifulSoup (html)"Python 3.5 아름다운 스프 4 Error UserWarning : 파서가 명시 적으로 지정되지 않았습니다
나는 다음 코드를 사용하십시오: 그럼
//anaconda/lib/python3.5/site-packages/bs4/__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
To get rid of this warning, change this:
BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], "lxml")
markup_type=markup_type))
Traceback (most recent call last):
File "<ipython-input-13-d4b16f497b1d>", line 1, in <module>
runfile('/Users/beckswu/Desktop/coursera/using python access web data/class 2.py', wdir='/Users/beckswu/Desktop/coursera/using python access web data')
File "//anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "//anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/Users/beckswu/Desktop/coursera/using python access web data/class 2.py", line 37, in <module>
soup = BeautifulSoup(html)
File "//anaconda/lib/python3.5/site-packages/bs4/__init__.py", line 212, in __init__
markup, from_encoding, exclude_encodings=exclude_encodings)):
File "//anaconda/lib/python3.5/site-packages/bs4/builder/_lxml.py", line 108, in prepare_markup
markup, try_encodings, is_html, exclude_encodings)
TypeError: __init__() takes from 2 to 4 positional arguments but 5 were given
내가
012에 코드를 변경 :from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
그것은 오류를 보여줍니다 3,516,
from bs4 import BeautifulSoup
soup = BeautifulSoup(html,"lxml")
markup_type=markup_type))
는 또한
markup_type=markup_type))
^
SyntaxError: invalid syntax
가 어떻게 그 문제를 해결 할 수있는 오류를 보여줍니다? 나는 누구의 도움에 감사드립니다. 대신 HTML의
을하는 데 도움이
희망 아래와 같이 HTML의 텍스트 파일을 통과해야합니까? –