inputfile = open('fruit', 'r').read()
inputstring = re.sub(whitespace, '', inputfile)
fruits = re.findall(fruitdef, inputstring)
print(fruits)
Python: how to avoid append an empty string in a for loop?