I'm going to be comparing user input to the values in a list that I have, say a list called names
. What's the best way to remove special characters, such as periods(.), hyphens(-), and/or apostrophes(') so that I can compare them with the list names
?
So for instance, my list would be somewhat similar to this:
names = ["john", "mike", "mark", "obrien", "lisamarie"]
Now let's say the user enters Lisa-Marie or O'Brien. How can I convert the user input into lisamarie or obrien?
Thanks for your help, guys! :)