admin管理员组文章数量:1415645
So I have a program that is passing down commands to a remote host and using shlex library to parse the args that way a incompleted quotation will not be sent down. And I notice this behavior
here is my intended behavior and working behavior on a string like this:
>>> lexer = shlex.shlex('"aaaaaaaaaaaaaaaa')
>>> list(lexer)
ValueError: No closing quotation
However for
>>> lexer = shlex.shlex('"\\"')
>>> list(lexer)
['"\\"']
Which of course when I run this on the remote host we are getting a waiting since its running this in bash "\"
. I would expect the above input to also give me a Value Error since the string is not closed.
Is this shlex intended behavor and if so why?
本文标签: pythonSeaming incorrect parsing of a string in shlexStack Overflow
版权声明:本文标题:python - Seaming incorrect parsing of a string in shlex - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745241522a2649354.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论