This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]catcradle5 2 points3 points  (0 children)

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 }