hello pals,
I need a help with using re module to search and convert uppercase words in a string to title case
Eg:

mystr='Hello everybody. Some times THERE ARE upper case words'
#Results should be 'Hello everybody. Some times There Are upper case words'

Hope you can give a hand to solve this.

Something like this could do it:

mystr = 'Hello everybody. Some times THERE ARE upper case words'
mylist = mystr.split()
#print mylist

newstr = ''
for word in mylist:
    if word[0].isupper():
        word = word.capitalize()
    newstr += word + ' '

print newstr

"""
my output -->
Hello everybody. Some times There Are upper case words
"""

Thank you every much. Problem solved. I thought I have to use regex. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.