문제

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_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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top