python判断字符串是否为空

来源:互联网 发布:linux系统管理技术手册 编辑:程序博客网 时间:2024/06/05 14:23


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


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











0 0