def not_empty(s): return s and s.strip()
1. and是运算符,相当于&&,none是空值。字符串" "需要用到strip,即 " ".strip()=""。所以none、""、" "返回值都是FALSE。
Sign in to make a reply
空心菜的烦恼777
1. and是运算符,相当于&&,none是空值。字符串" "需要用到strip,即 " ".strip()=""。所以none、""、" "返回值都是FALSE。