Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27640

Re: help me debug my "word capitalizer" script

From Rebelo <puntabluda@gmail.com>
Newsgroups comp.lang.python
Subject Re: help me debug my "word capitalizer" script
Date 2012-08-22 07:46 -0700
Organization http://groups.google.com
Message-ID <035e81d4-8e43-40fd-a0fa-c60b28f0703a@googlegroups.com> (permalink)
References <CAE7MaQbrdVbbFWDJ8GHuoybT2SNPfZyyMFU_beBc_zMKpBHPFg@mail.gmail.com> <CAEtwbM0PwcSb6v5MZ=Dr3s9TVFoXzCOywd=JfWFfBUcM-RFLcQ@mail.gmail.com> <CAPTjJmr7JqsDx6ypjVODTvy315fFYZacNgns60QXmM+zJ5p+Xw@mail.gmail.com> <CAEtwbM2MZ9D_dwv0EYXF8h5G=ucOjVm33Y3Z+E=aMY1fr17Nxw@mail.gmail.com> <mailman.3647.1345640467.4697.python-list@python.org>

Show all headers | View raw


> Let's move to Bug #2:
> 
>  2. How do I escape the words that are already in uppercase? For example:
> 
> 
> 
> The input file has this:
> 
> NASA
> 
> 
> 
> The script changes this to:
> 
> Nasa
> 
> 
> 
> Is it possible to make this script look at a word, see if its first
> 
> character is capitalized, if capitalized then skip that word. If not
> 
> do the processing? I don't wan to use regex? Do I need it?

change: 
 words[i] = word.capitalize() 

into:
if word != word.upper() :
     words[i] = word.capitalize() 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: help me debug my "word capitalizer" script Santosh Kumar <sntshkmr60@gmail.com> - 2012-08-22 18:30 +0530
  Re: help me debug my "word capitalizer" script Rebelo <puntabluda@gmail.com> - 2012-08-22 07:46 -0700
    Re: help me debug my "word capitalizer" script Terry Reedy <tjreedy@udel.edu> - 2012-08-22 13:40 -0400
  Re: help me debug my "word capitalizer" script Rebelo <puntabluda@gmail.com> - 2012-08-22 07:46 -0700

csiph-web