#-*-coding:utf-8-*- ‘‘‘ 写函数,判断用户传入的对象(str,列表,元组)的每一个元素是否有为空,并返回 ‘‘‘ def func(x): ‘‘‘str‘‘‘ if type(x) is str and x: for i in x: if i == ‘ ‘: return True elif x and type(x) is list or type(x) is tuple: for i in x: if not i: return True print(func([1,‘‘,9])) print(func([]))
原文地址:https://www.cnblogs.com/sunnybowen/p/10258200.html
时间: 2024-11-06 03:32:08