【问题标题】:Adding input from user to a url将用户输入添加到 url
【发布时间】:2020-03-31 03:55:11
【问题描述】:

我正在尝试在 python 中使用 BS 从网站中删除一些数据 我对beautifulsoup很陌生,所以不太了解 这是我想做的一个例子

https://www.example.com/example/add-input/

我想添加从用户那里获取的输入以将其添加到 url 并抓取数据

【问题讨论】:

标签: python-2.7 beautifulsoup python-requests


【解决方案1】:

使用 python 2 你会得到这样的输入:

x = raw_input()

使用 python 3 只是

x = input()

然后您可以像这样将输入添加到 URL:

url = 'https://www.example.com/example/' + x

然后根据你的需要刮。网上有很多bs4的教程。

【讨论】:

    猜你喜欢
    • 2018-06-15
    • 1970-01-01
    • 2016-01-31
    • 2016-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-02
    • 1970-01-01
    相关资源
    最近更新 更多