Hello again :) I'm trying to define a simple "spelling correction" function that takes a string and sees to it that 1) two or more occurrences of the space character is compressed into one, and 2) inserts an extra space after a period if the period is directly followed by a letter. My piece of code is not working. Please advise.
import re def correct(s): rem = re.sub('\+','',s) # hoping that this remove extra spaces. #rem = re.sub('\.','. ',rem) # and this inserting extra spaces after a period. print rem s = raw_input('input a weird string: ') correct(s)