关于笨方法学python中的练习13:Parameters, Unpacking, Variables中的错误,求解答,谢谢。

27 views
Skip to first unread message

lxt

unread,
Jun 23, 2013, 1:49:24 AM6/23/13
to mstc...@googlegroups.com
from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third

将上述代码保存为ex13.py。然后,在命令行中输入:
python ex13.py first 2nd 3rd

结果为:SyntaxError: invalid syntax

实在不知道哪里错了 希望大家搭把手,帮忙解答下 谢啦

Hugo Feng

unread,
Jun 23, 2013, 2:09:30 AM6/23/13
to mstc...@googlegroups.com

看一下自己用的什么版本python, 3和2.7的很多语法有细微区别,例如print

Sending from Nexus 4

--
--
您收到此信息是由于您订阅了 Google 论坛“西电MSTC讨论组”论坛。
要在此论坛发帖,请发电子邮件到 mstc...@googlegroups.com
要退订此论坛,请发邮件至 mstcinxdu+...@googlegroups.com
更多选项,请通过
http://groups.google.com/group/mstcinxdu 访问该论坛
关注西电微软技术俱乐部最新动态:
人人:http://www.renren.com/mstcinxdu
微博:http://weibo.com/mstcinxdu
博客:http://hi.baidu.com/mstcinxdu
BBS:好网、睿思 微软俱乐部版
 
---
您收到此邮件是因为您订阅了 Google 网上论坛的“西电MSTC讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 mstcinxdu+...@googlegroups.com
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
 
 

不系之舟

unread,
Jun 23, 2013, 4:42:50 AM6/23/13
to mstc...@googlegroups.com
恩 谢谢 该问题已解决 有点不好意思 电脑里本来装了个Python2.5的版本 现在在用2.7版本 然后忘了添加系统变量 不好意思
要退订此论坛,请发邮件至 mstcinxdu+unsub...@googlegroups.com

更多选项,请通过
http://groups.google.com/group/mstcinxdu 访问该论坛
关注西电微软技术俱乐部最新动态:
人人:http://www.renren.com/mstcinxdu
微博:http://weibo.com/mstcinxdu
博客:http://hi.baidu.com/mstcinxdu
BBS:好网、睿思 微软俱乐部版
 
---
您收到此邮件是因为您订阅了 Google 网上论坛“西电MSTC讨论组”中的主题。
要退订此主题,请访问 https://groups.google.com/d/topic/mstcinxdu/yKul2TzeqFA/unsubscribe。
要退订此论坛及其所有主题,请发送电子邮件到 mstcinxdu+unsub...@googlegroups.com
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
 
 


lxt

unread,
Jun 23, 2013, 4:45:32 AM6/23/13
to mstc...@googlegroups.com
不好意思 忘了添加系统变量引起的错误 谢谢回复 该问题已经解决。

在 2013年6月23日星期日UTC+8下午1时49分24秒,lxt写道:
Reply all
Reply to author
Forward
0 new messages