[portland] Script to Change UPPER CASE to Mixed Case

Rich Shepard rshepard at appl-ecosys.com
Tue Sep 22 02:59:39 CEST 2009


On Mon, 21 Sep 2009, Rami Kassab wrote:

> Rich, I believe what you're referring to is Title Case. Python has a built
> in method for strings called title(), which you could use but it doesn't
> take into account small words. I found this method,
> http://muffinresearch.co.uk/archives/2008/05/27/titlecasepy-titlecase-in-python/,
> that follows some rules from the New York Times for title casing. As for a
> way to automate this for your CSV, it might be difficult to find a
> pre-written script that does that and title cases for you but it's very
> trivial to use the Python CSV reader library and just loop through each
> line, run a title case method on the fields you want, and save the output.
>
> Hope this helps. Good luck!

Rami,

   I'm sure it will help. Some strings are single words (such as the city
name), others are multiple words (such as the facility description).
Probably only the first word should be capitalized, not all of them. But,
tomorrow I'll look again at the data and see what I really want.

   Thanks very much for the pointer.

Rich


More information about the Portland mailing list