def de_blank ( val ) : ret = list ( val ) if type ( val ) == list : for idx , item in enumerate ( val ) : if item . strip ( ) == '' : ret . remove ( item ) else : ret [ idx ] = item . strip ( ) return ret
remove [ from a variable in python
Remove blank elements in val and return ret
def de_blank(val):
    """Remove blank elements in `val` and return `ret`"""
    ret = list(val)
    if type(val) == list:
        for idx, item in enumerate(val):
            if item.strip() == '':
                ret.remove(item)
            else:
                ret[idx] = item.strip()
    return ret