摘要:
Python 循环while和for循环在python里面基本和java等其他语言类似,由于python的语言风格,所以在写while和for时,条件语句不需要用括号:并且for的使用比while更常见,以循环输出0-5的整数为例i=0while i<=5: print (i) i+=1;for i in range(6): print (i)值得注意的市python里面貌似是不支持++和--这样的自增自减运算的,所以这里while循环不能写i++,也不能写++i;前者python编译器不识别,后者识别为+(+i),也就是说i不会变化,不断打印0,将导致死循环的产生,此时... 阅读全文
posted @ 2013-07-31 15:29
小文字
阅读(4162)
评论(0)
推荐(0)

浙公网安备 33010602011771号