I have a list of words and am trying to replace all the numbers in my list with whitespace.
I am not getting any errors, but when the words are printed, all of the numbers in in list words are printed. So it doesn't give me any errors but it doesn't work. What would I need to do to accomplish my task?
Code:
for word in words: numbers = re.search('[0-9]+', word) word = clearup(word) if word in dictionary: pass else: print word
Code:
def clearup(tor): numbers = re.search('[0-9]+', tor) return tor.replace('%s' % numbers, '')\ .replace('.', '')\ .replace(',', '')\ .replace(',', '')\ .replace(':', '')\ .replace('!', '')\ .replace('@', '')\ .replace('#', '')\ .replace('$', '')\ .replace('%', '')\ .replace('(', '')\ .replace(')', '')\ .replace('?', '')\ .replace('-', ' ')\ .replace(';', '')\ .lower()
Comment