On Mon, 28 Jul 2014 11:52:03 +0800, 水静流深 wrote:
> there is a simple file `mydown.py` saved in
> `D:\Python34\Lib\site-packages`
> there is only one line in mydown.py .
>
> import requests
Just because mydown has imported requests, doesn't mean it is visible
everywhere. Each module is a sepa
Greetings,
> there is only one line in mydown.py .
>
>
> import requests
> ...
> >>> import mydown
> >>> requests.get(url)
>
> Traceback (most recent call last):
>
> File "", line 1, in
>
> NameError: name 'reque
, '__cached__', '__doc__', '__file__', '__loader__',
> '__name__',
> '__package__', '__spec__', 'requests']
>>>> url='http://quote.eastmoney.com/hk/0.html?StockCode=0'
>
_package__', '__spec__', 'requests']
>>> url='http://quote.eastmoney.com/hk/0.html?StockCode=0'
>>> requests.get(url)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'requests' is not defined
why it run into "NameError: name 'requests' is not defined"?--
https://mail.python.org/mailman/listinfo/python-list