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)

 

posted @ 2020-06-26 14:27  cy583  阅读(1034)  评论(0编辑  收藏  举报