喝靓汤吃错了

2024-04-25 22:13:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我在命令行使用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 

为什么会这样?你知道吗


Tags: 命令行infalsedatalineresultvarsfind