gpt4 book ai didi

python ,预计: sendline() adding unexpected whitespace in sending text

转载 作者:太空宇宙 更新时间:2023-11-04 12:06:33 25 4
gpt4 key购买 nike

我在 ubuntu 16.04 上使用 python=2.7pexpect=4.5.0

这是代码:

telnet.sendline("ls --color=never | grep -v bootimage | xargs -n1 rm -rf")

我正在从我的 ubuntu 计算机将此行发送到嵌入式 linux 机器,我在 virutalenv 中。

然而,这台嵌入式机器得到的是:

ls --color=never | grep -v bootimage | xar gs -n1 rm -rf

我的意思是,为什么 xargs 变成了 xar gs ...???我该如何解决?

注意:1.我还发送了其他更短的命令,它们很好。2. 曾经很好。这种情况不会一直发生。

最佳答案

使用原始字符串可能是更好的选择,例如 telnet.sendline(r"ls --color=never | grep -v bootimage | xargs -n1 rm -rf")

关于 python ,预计: sendline() adding unexpected whitespace in sending text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50532593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com