Python的argv数组不包含从shell传递的'#'

时间:2019-05-12 19:28:57

标签: python python-3.x shell command-line-arguments

我试图读取传递的参数,但遇到一个奇怪的问题。代码很简单,看起来像这样:

import sys

arguments = sys.argv

for argument in arguments:
    print(argument)

当我尝试使用以下命令传递参数时,它会按预期工作:

python3 clean.py -f redis.conf -c char

结果:

clean.py
-f
redis.conf
-c
char

但是,将忽略特殊字符,例如菱形“#”:

python3 clean.py -f redis.conf -c #

结果:

clean.py
-f
hey
-c

有人可以指出我忽略的地方吗?预先感谢。

0 个答案:

没有答案
相关问题