【问题标题】:Python OS doesn't see variablesPython OS 看不到变量
【发布时间】:2021-10-09 21:47:09
【问题描述】:

我目前正在开发一个应用程序,允许用户使用 PC 在他们的 FireTV 上安装 .apk 文件。我目前遇到关于操作系统的问题:它看不到变量(我尝试过使用 format 和正常)。

这是我的代码:

while True:
    event, values = window.read()

    ip = values["-IP-"]
    path = values ["-PATH-"]
    
    if event == pyg.WINDOW_CLOSED:
        exit()

    if event == 'Start':
        os.system(f'adb push {ip} {path}')

【问题讨论】:

  • 没有显示变量?应该粘贴什么故障。 IMO,也许您的 python 中没有新的 f-string 功能。从 python 3.6 开始,PEP 498 引入了一种新的字符串文字:f-strings,或格式化的字符串文字。

标签: python operating-system pysimplegui


【解决方案1】:

请试试这个。

`if event == 'Start':
    cmd = "ls -{0} -{1}".format(ip, path)
    os.system(cmd)`

【讨论】:

    猜你喜欢
    • 2017-01-28
    • 2018-11-24
    • 1970-01-01
    • 1970-01-01
    • 2019-01-31
    • 2016-01-05
    • 2021-11-03
    • 1970-01-01
    • 2011-07-02
    相关资源
    最近更新 更多