Empty a variable without destroying it
Do this:
def EmptyVar(lst):
return [type(i)() for i in lst]
type()
produces the type object for each value, which when called produces an 'empty' new value.
Demo:
>>> a = "aa"
>>> b = 1
>>> c = { "b":2 }
>>> d = [3,"c"]
>>> e = (4,5)
>>> letters = [a, b, c, d, e]
>>> def EmptyVar(lst):
... return [type(i)() for i in lst]
...
>>> EmptyVar(letters)
['', 0, {}, [], ()]