在Ipython中更改BeautifulSoup的默认提示

时间:2018-08-18 05:00:39

标签: python beautifulsoup ipython

当我使用美丽汤时,

In [50]: exampleFile = open("example.html")
In [51]: exampleSoup = bs4.BeautifulSoup(exampleFile)
/Users/me/anaconda3/lib/python3.6/site-packages/bs4/__init__.py:181: 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.

The code that caused this warning is on line 11 of the file /Users/me/anaconda3/bin/ipython. To get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "lxml")

  markup_type=markup_type))

这提醒我更改/Users/me/anaconda3/bin/ipython的第11行

但是,文件中没有第11行

#!/Users/me/anaconda3/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from IPython import start_ipython

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(start_ipython())

我该如何解决问题?

0 个答案:

没有答案