文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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
排行榜 更多 +
涂鸦射手最新版

涂鸦射手最新版

休闲益智 下载
欢乐火车向前冲游戏

欢乐火车向前冲游戏

赛车竞速 下载
荣誉打工人钞票不减反增

荣誉打工人钞票不减反增

模拟经营 下载