python-3.x - 为什么这在我的request.get变量上显示为语法错误?

标签 python-3.x beautifulsoup python-requests syntax-error

我收到此错误:

invalid syntax (<unknown>, line 4)pylint(syntax-error)

第四行的结果语法无效。
import requests
from bs4 import BeautifulSoup

result = requests.get(https://www.google.com/)

result.status_code == requests.codes.ok

最佳答案

毕竟,您应该考虑使用真正的IDE来编写代码(例如Eclipse/PydevPycharmVSCode),这将有助于您避免此类错误。

您缺少URL周围的引号:

result = requests.get("https://www.google.com/")

关于python-3.x - 为什么这在我的request.get变量上显示为语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54535050/

相关文章:

python - 美丽汤提取物循环

python - beautifulsoup 和无效的 html 文档

python-2.7 - 请求模块中的 Python 错误 "Connection reset by peer"

javascript - 抓取页面以获取编码的 javascript 链接

python - OJ 说我的 python 程序编译错误,即使它在我的计算机上运行良好(ubuntu 18.04)

python - pygal:多系列饼图上的标签

python - 使用 Beautiful Soup 在 python 中解析网页

python - TypeError : must be convertible to a buffer, 不是 HTTPResponse

string - str 任意从 latin-1 编码到 utf-8

python - 使用列表理解无法执行比较我该如何解决