【问题标题】:How can I use url variable as url in code如何在代码中使用 url 变量作为 url
【发布时间】:2022-07-20 14:31:11
【问题描述】:
URL = input("Plz enter you Url")

import os

os.system("youtube-dl -f 95  -g **URL**")

我向用户询问了 url,我想在第三行使用提供的 url

【问题讨论】:

  • 你可以做类似os.system(f"youtube-dl -f 95 -g {URL}")

标签: python


【解决方案1】:

你可以在python中使用.format

所以

URL = input("Plz enter you Url")

import os

os.system("youtube-dl -f 95  -g {}".format(URL))

【讨论】:

    【解决方案2】:

    使用字符串格式:

    URL = input("Plz enter you Url")
    
    import os
    
    os.system(f"youtube-dl -f 95  -g {URL}")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-12
      • 1970-01-01
      • 1970-01-01
      • 2017-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多