如何在Python中的字符串中添加“

Daquaney

我正在尝试在Windows中启动torrent下载器,该下载器是从命令提示符下执行的。它接受诸如的命令torrent "magnet_link"我遇到的问题是当我os.system("start /wait cmd /c torrent " + '"' + link + '"')出于某种原因从python启动命令时,在启动的命令提示符窗口中未显示字符,这使该命令无用。我得到的响应是:'dn' is not recognized as an internal or external command, operable program or batch file.

克里斯

使用可以使用内置的str.center

link = 'http://stackoverflow.com'
print("start /wait cmd /c torrent %s" % link.center(len(link)+2, '"'))

# start /wait cmd /c torrent "http://stackoverflow.com"

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章