View Full Version : tryng to make a python acronym maker

Feb 8, 2008, 10:28 PM
thanks to agbot. i took what you wrote modified it and got what i needed. thanks from a python n00b!

Feb 8, 2008, 11:17 PM
You want to iterate through the result of split():

>>> from string import *
>>> def acro(phrase):
... result = ""
... for word in split(phrase):
... result += word[0].upper()
... return result
>>> acro("hello python how are you")

I'm a Python newbie so there may be 100 different and better ways to do acronyms, but there's my take at least. :)

Feb 9, 2008, 01:46 AM
I suggest not erasing your original post in case someone ever reads the thread again, that way they can see what people were responding to.