我在 python 2.7 中有一个程序,它使用 接受命令行参数argparse
,但是如果我尝试输入包含与号的字符串,我会丢失该与号之后的字符。
例如:
我有一个简单的 python 程序只是为了测试命令行参数的输入,并简单地打印出为单个命令行参数输入的内容。
本质上: print args.where
当我用这样的参数运行程序时:
$ python args.py -a http://www.website.com?optionone=one&numbertwo=two
Run Code Online (Sandbox Code Playgroud)
打印到屏幕上的唯一文本是:http : //www.website.com?optionone=one
使用 sys 和 printIng 使用 Argv 时,我有类似的结果
我怎样才能输入完整的字符串?