我在使用系统argv为了能够从命令行运行程序。我的3.5版本是闲置的。我尝试过通过命令提示符和Python(3.5)命令行运行下面的程序。我收到一个错误:
在Python(3.5)中:>>> python testing.py
File "", line 1
python testing.py
^
SyntaxError: invalid syntax
>>>
在命令提示符下:
^{pr2}$
在测试.py内容如下:import sys
def main():
print sys.argv
if __name__ == "__main__":
main(sys.argv)
我看的教程显示,这个python文件,当从命令行执行时,只返回程序的名称”测试.py““
我怀疑文件目录有问题,当命令行试图打开文件时,它不存在。在
有人知道我该怎么解决问题吗?如果是这样的话,我该怎么纠正呢?在
抱歉,如果我在这里的问题格式不好。我是python和stackoverflow的新手,我还不知道自己在做什么。在
dir的输出:C:\Users\Brice_000>dir
Volume in drive C has no label.
Volume Serial Number is 60E5-73E9
Directory of C:\Users\Brice_000
11/01/2015 04:45 PM
11/01/2015 04:45 PM
11/01/2015 04:47 PM
11/01/2015 05:07 PM
06/21/2015 09:20 PM
08/23/2015 08:00 PM
01/11/2013 03:59 PM
11/01/2015 04:45 PM
09/15/2015 10:12 PM
10/14/2015 08:48 AM
08/29/2015 04:28 PM
11/16/2015 05:08 PM
11/20/2015 11:32 PM
11/24/2015 02:26 PM
04/08/2013 10:26 PM
01/12/2013 01:16 PM
10/14/2015 08:48 AM
06/21/2015 09:37 PM 23 jagexappletviewer.preferences
02/26/2013 06:31 PM
06/21/2015 09:21 PM
02/19/2013 07:45 PM 50 jagex_cl_loginapplet_LIVE.dat
05/13/2014 10:34 PM 48 jagex_cl_oldschool_LIVE.dat
06/21/2015 09:21 PM 48 jagex_cl_runescape_LIVE.dat
06/21/2015 09:21 PM 49 jagex_cl_runescape_LIVE1.dat
10/14/2015 08:48 AM
10/20/2015 05:30 AM
11/05/2015 12:42 AM
10/28/2015 08:50 PM
06/22/2015 12:32 AM 24 random.dat
10/14/2015 08:48 AM
10/14/2015 08:48 AM
08/04/2015 08:35 PM
02/25/2014 03:54 AM
04/07/2014 01:55 PM
02/16/2014 02:50 PM
03/12/2015 08:15 PM
10/14/2015 08:48 AM
6 File(s) 242 bytes
31 Dir(s) 49,005,813,760 bytes free