Titlecase for Python

Posted on August 8, 2009
Filed Under Python | 2 Comments

Python has a built in method for doing titles. Unfortunately it really sucks. I was looking for a way to capitalize blog posts (code in a subsequent post). I came upon Titlecase for Python.

You can install it via easy_install.

easy_install titlecase

Or if you are using 3.0 try downloading it.

Comments

2 Responses to “Titlecase for Python”

To get titlecase.py working in Python 3, you’ll need to change a line near the bottom of the file from

print titlecase(line)

to

print(titlecase(line))

Also, if you want titlecase.py to work like John Gruber’s TitleCase.pl (which was its inspiration), you’ll have to make a few other changes described here:

http://www.leancrew.com/all-this/2009/08/capitalization-and-titlecasepy/

Thanks for that. Like you I was going to use it for fixing up iTunes as well as for standardize blog post titles. I figure that this would be the week I start cleaning up my library.

Leave a Reply