用美丽的汤获取NameError

时间:2014-09-05 18:35:21

标签: python beautifulsoup pycharm

我在命令行使用bs4:

>>> listing.find("a",{"data-oname": "result"})
<a data-consolidated-tab="false" data-oname="result" href="xxx">3 yyy</a>
>>> a =listing.find("a",{"data-oname": "result"})
>>> a
Traceback (most recent call last):
  File "C:\PyCharm 3.4.1\helpers\pydev\pydevd_exec.py", line 3, in Exec
    exec exp in global_vars, local_vars
  File "<input>", line 1, in <module>
NameError: name 'a' is not defined 

为什么会这样?

0 个答案:

没有答案