【问题标题】:Download a file from a url present in a txt file with python 2.7.9使用 python 2.7.9 从 txt 文件中的 url 下载文件
【发布时间】:2021-06-16 11:21:07
【问题描述】:

我在下面为 python 3 编写了这个脚本,这对 python 3 非常有用,但是对于 python 2,这个脚本不起作用,你知道任何方法可以使它与 python 2.7.9 一起工作吗?

import wget

with open ("abcd_url.txt", encoding='utf-8', mode = 'r') as f:
    for url in f.readlines():
        filename = wget.download(url.strip())
        print (filename)

【问题讨论】:

    标签: file url text download wget


    【解决方案1】:

    你应该使用这个3to2。它会转换它。

    【讨论】:

      猜你喜欢
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-23
      • 1970-01-01
      • 1970-01-01
      • 2017-12-25
      • 2022-01-18
      相关资源
      最近更新 更多