分类: Python/Ruby
2010-12-16 13:55:15
方式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