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')
【Python Trick】判断字符串是否为空
最新推荐文章于 2024-06-16 19:28:19 发布
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')