Chinaunix首页 | 论坛 | 博客
  • 博客访问: 253249
  • 博文数量: 71
  • 博客积分: 3044
  • 博客等级: 少校
  • 技术积分: 695
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-16 11:06
文章分类

全部博文(71)

文章存档

2011年(30)

2010年(41)

分类: Python/Ruby

2010-11-07 19:27:52

这个东西做完半夜开始看的,当时很兴奋,觉得是个不错的东西,今天就继续看。现在敲了几行,看看如何好玩了。就这样学习,也是就这样慢慢的遇到问题,当然这就是学习了。遇到了几个貌似是很多初学者都遇到的问题吧,所以记录下来。。。

我就是希望看看if-else的运行效果,但是就这个就遇到了问题了 ,code如下:
IDLE 2.6.2      
>>> 

>>> testdata = 12
>>> print testdata
12
>>> if testdata !=1:
testdata = 12

>>> else:
SyntaxError: invalid syntax
>>> if testdata != 1:
testdata = 51

>>> print testdata
51
>>> if testdata != 12:
testdata = 21
    else:
   
  File "", line 3
    else:
        
^
IndentationError: unindent does not match any outer indentation level
>>> if testdata != 12:
testdata = 21

>>> testdata
21
>>> if testdata != 12:
testdata = 12
else:
test = 32

>>> testdata
12
>>> if testdata != 12:
testdata = 32
else:
testdata = 43

>>> testdatqa

Traceback (most recent call last):
  File "", line 1, in
    testdatqa
NameError: name 'testdatqa' is not defined
>>> testdata
43
>>> 
下面的才是真正的if-else   哈哈 


阅读(1216) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~