>>> import string
>>> word = "hello."
>>> word2 = word.replace(string.lowercase, '.')
>>> print word2
hello.
I just want all the lowercase letters to turn into full stops.
What am I doing wrong here?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a regular expression:
str.replaceis looking for the stringabcdefghijklmnopqrstuvwxyzto replace it with., not looking for each individual letter to replace.