I am pretty much finished with this code but I can’t get the letter “t” — lower case and upper case — to be replaced by a space. Tho format of my code should be the same but I just need help replacing the “t” with a space. For example, “The book on the table thttg” should look like ” he book on he able h g.” So, pretty much the “t” should be hidden.
def remoeT(aStr):
userInput = ""
while True:
string = raw_input("Enter a word/sentence you want to process:")
if string == "Quit":
return userInput
userInput = userInput + string
if aStr != False:
while "t" in userInput:
index = userInput.find("t")
userInput = userInput[:index] + userInput[index+1:]
while "T" in userInput:
index = userInput.find("T")
userInput = userInput[:index] + userInput[index+1:]
To replace all occurrences of
tandTwith a space in the stringinput, use the following:Or with regular expressions: