from googlefinance import getQuotes
print(getQuotes("NSE:M\&MFIN"),)
&符号被视为代码,但我想将其视为文本;我收到一个错误的请求异常:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../site-packages/googlefinance/__init__.py", line 70, in getQuotes
content = json.loads(request(symbols))
File "/.../site-packages/googlefinance/__init__.py", line 33, in request
resp = urlopen(req)
File "/.../urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/.../urllib/request.py", line 532, in open
response = meth(req, response)
File "/.../urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/.../urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/.../urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/.../urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
我试图逃避它(使用 a \
),但这也不起作用。
如何将此&符号视为文本?