文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Python 学习笔记 - 4.if 表达式

Python 学习笔记 - 4.if 表达式

时间:2010-12-16  来源:sun5411

方式1

>>>>>> s = ""  
>>>>>> a = s or "not none"
>>>>>> a
'not none'

>>>>>> s = None
>>>>>> a = s or "not none"
>>>>>> a
'not none'

>>>>>> s = "aa"
>>>>>> a = s or "not none"
>>>>>> a
'aa'

 

方式2

>>>>>> s = None  
>>>>>> a = "not null" if s == None else s
>>>>>> a
'not null'

>>>>>> s = "aa"
>>>>>> a = "not null" if s == None else s
>>>>>> a
'aa' 转载自:http://www.xwy2.com/article.asp?id=108
排行榜 更多 +
虚拟战警

虚拟战警

飞行射击 下载
反恐射击英雄最新版

反恐射击英雄最新版

飞行射击 下载
坦克交火

坦克交火

飞行射击 下载