开发者

Escape @ from python line command

开发者 https://www.devze.com 2022-12-18 18:20 出处:网络
I don\'t know if this is a problem with python or with the shell (zsh on linux), I\'ve an argument like this: \"@xyz\" that starts with a \"@\"

I don't know if this is a problem with python or with the shell (zsh on linux), I've an argument like this: "@xyz" that starts with a "@"

python the_script.py first_argument @second开发者_Python百科_argument third_arg

I tried to escape @ with \ or \\, or use "" but the program doesn't start. If I leave the @ from @second_arguments everything's ok.


  1. Perhaps the "@" is a glob character in zsh, expanding to all symbolic links in the current directory. Try escaping it with "@@"?

  2. Try running the argument list with echo, i.e:

    echo the_script.py first_argument @second_argument third_arg

That way, you can figure out if it was expanded or passed as-is to the script.

0

精彩评论

暂无评论...
验证码 换一张
取 消