python 字符串检查的简单工具方法

Python最近开始学写脚本

很简单,记录一下,以后方便复制,如果后面遇到比较好的库再更新

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

def (s):
if isinstance(s, str):
return s.strip()
else:
return ''


# 判断字符不为空
def is_not_empty_str(s):
if s is None:
return False
elif isinstance(s, str):
return s.strip() != ""
else:
return False

喜欢请点个赞,

转载请注明出处:https://www.jianshu.com/u/4915ed24d1e3

如有错误,请务必指正!谢谢!

我的博客:https://xzing.github.io/