python判断字符串是否为空


#encoding=utf-8
str=""
if str.strip()=="":
    print("str is null")
if not str.strip():
    print("str is null")


#encoding=utf-8
str="hello"
if str.strip()=="":
    print("str is null")
if str.strip():
    print("str is not null")