python 控制语句 else,pythonelse,python中的else
python 控制语句 else,pythonelse,python中的else
python中的else不只可以跟if搭档,还可以和while,for,try一起使用。
和if搭档 if ... elif .. else
i=1if i>0: print 'i>0'elif i==0: print 'i==0'else: print 'i<0'
else和while搭档
i=0while i<10: print 'while i=%d'%(i,)else: print 'else i=%d'%(i,)
else和for搭档
for i in xrange(10): print 'for i=%d'%(i,)else: print 'else i=%d'%(i,)
else和try..except搭档
和try..except搭档时表示正常执行完了try语句块未发生异常时要执行的后续代码
try: i=0 print 'i'except Exception,e: print eelse: print 'try end'
相关内容
- 两种python 判断网页编码的方法,python判断网页编码,这
- python字符串方法总结,python字符串总结,python的字符串模
- python 使用datetime模块timedelta实现日期时间相加,dateti
- python时间日期模块使用总结,python模块,python中关于时间
- python string to datetime datetime to string,pythondatetime,python日
- 访问需要HTTP Basic Authentication认证的资源的python实现,
- python设置socket的超时时间,pythonsocket超时,在使用urlli
- python卸载模块,python卸载,在python中如果不再
- python的is运算符,pythonis运算符,python的is运算符
- python模拟ajax请求,获得ajax请求响应,pythonajax,有些网站
评论关闭