python-函数-写函数,检查传入的字符串是否含有空字符串,返回结果,包含空字符串返回True,不包含返回False

'''
写函数,检查传入的字符串是否含有空字符串,返回结果,包含空字符串返回True,不包含返回False
例如:
传入:"hello world"
返回:True
'''

def a(s):
    if isinstance(s,str) or isinstance(s,list) or isinstance(s,tuple):
        for i in s:
            #if i==' ':
            if i.isspace():
                return 'true'
            else:
                return 'False'
    #else:
        #return None
l3=["hello world"]
ret=a(l3)
print(ret)
原文地址:https://www.cnblogs.com/cy-zjs/p/13194920.html