On 9/10/2011 7:47 AM, Peter Otten wrote:

You can work around that with a
flag along these lines

first = True
for word in title_split:
     if first:
         # special treatment for the first word
         first = False
     else:
         # put checks for all words but the first here
     new_title.append(fixed_word) # assuming you have stored the titlecased
                                  # or lowercased word in the fixed_word
                                  # variable

An alternative to a flag and testing every item is to remove and process the first item *before* the loop. See my response on this thread or my new thread
Idioms combining 'next(items)' and 'for item in items:'

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to