#python 字符串 判空
mystr1 = ' '
if mystr1.strip() == '': # strip() 会去掉字符串两边的空字符
print( 123 )
如果对空值判断的次数比较多,可以自己封装成函数,提高效率。
#python 字符串 判空
mystr1 = ' '
if mystr1.strip() == '': # strip() 会去掉字符串两边的空字符
print( 123 )
如果对空值判断的次数比较多,可以自己封装成函数,提高效率。