【Python】如何判断一个字符串为空

来源:互联网 发布:js代码高亮插件 编辑:程序博客网 时间:2024/06/05 23:07
  1. #方法一  
  2. if oneString:  
  3.     print "not empty"  
  4. else:  
  5.     print "empty"  
  6.   
  7. #方法二  
  8. if oneString == "":  
  9.     print "empty"  
  10. else:  
  11.     print "not empty"