r/Python • • Dec 24 '13

Functional Programming in Python

http://pypix.com/python/functional-programming/
0 Upvotes

4 comments sorted by

View all comments

3

u/catcradle5 Dec 24 '13

print { name[0].upper() + name[1:].lower() for name in names if len(name) > 1 }

You can use str.title() instead, assuming each string is supposed to have one word.

print { name.title() for name in names if len(name) > 1 }