Possible Duplicate:
Python: What is the best way to check if a list is empty?
def CleanWhiteSpace(theDict):
stuff=[]
for key,value in theDict.items():
for d in value:
if value != " ":
stuff.append(d)
print d
theDict[key]=stuff
if not value[d]:
print value
stuff=[]
return theDict
print CleanWhiteSpace({'a':['1','2'],'b':['3',' '],'c':[]})
I edited this because I need more help. How do you check if c
is blank? Is c
is simply equal to []
?
I've tried ==[]
and "[]"
and getting the length and == ""
, but nothing seems to work.