【Python Trick】判断字符串是否为空

来源:互联网 发布:淘宝买115会员2017 编辑:程序博客网 时间:2024/06/06 02:56
str=''if str.strip()=='':    print('str is null')if not str.strip():    print('str is null')str='hello'if str.strip():    print('str is not null')