I'm trying to remove all spaces from the input which is list of list of lists... I don't know what to do for the "else:"
def removespace(lst):
if type(lst) is str:
return lst.replace(" ","")
else:
?????
Example:
lst = [ apple, pie , [sth, [banana , asd, [ sdfdsf, [fgg]]]]]
The output should be:
lst2 = [apple,pie,[sth,[banana,asd,[sdfdsf,[fgg]]]]]
and what to do if the lst contains integers or floating points? I have received errors for integers.
example input :
L = [['apple', '2 * core+1* sth'], ['pie', '1*apple+1*sugar+1*water'], ['water', 60]]