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


Groups > comp.lang.python > #27635

Re: help me debug my "word capitalizer" script

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'escape': 0.07; 'subject:help': 0.07; 'python': 0.09; '22,': 0.09; 'lookup': 0.09; 'subject:script': 0.09; 'bug': 0.10; 'cc:addr:python-list': 0.10; 'aug': 0.13; 'andreas': 0.16; 'ok!': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'fixed.': 0.17; 'skip': 0.17; 'shell': 0.18; 'input': 0.18; 'changes': 0.20; 'received:74.125.82.174': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'message- id:@mail.gmail.com': 0.27; 'kumar': 0.29; 'url:mailman': 0.29; 'character': 0.29; 'words': 0.29; 'url:python': 0.32; 'file': 0.32; 'url:listinfo': 0.32; 'received:74.125.82': 0.33; 'word.': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'there': 0.35; 'received:74.125': 0.36; 'url:org': 0.36; 'subject:" ': 0.36; 'url:library': 0.36; 'possible': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'header:Received:5': 0.40; 'url:mail': 0.40; 'your': 0.60; 'first': 0.61; '#2:': 0.84; 'url:string': 0.84; '9:00': 0.91; 'joel': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/7UyzErQOs5TuCup14LBy3y+jsGV2PuasPg+bxLzMU4=; b=jNuhm8Owln1DtRVpe1A8wsSL+44NmGR4Rl9OUqE4AZ8NahD7cDeFR996uP1G6xJ8pA i+bqgKH4BnNZ0jO/qSGxNYg/T9OxOOc3Xm5hjKUKAeQ/jF9MghxU1x+NPtmZneeSq61k EG2meKuxye5mSKwLuKQgXvKS0MnzcIHRizJuemny39rk0dP/jIZbqJLIXyT92zKKFmQD wwd5LNIELa+nDqPId4ma0UFBymGCP1XbGkVxTRd1HGQhmO0HI+QPtPJmcP7vOMNi4CYQ +NyDGIRHCBBLpHbzGIg0mq9O0tPsJrTWSVgqj6P+Tsp0eJJoCo76fYWKKHIBM+XCNOMt wvyQ==
MIME-Version 1.0
In-Reply-To <CAE7MaQaecoDCK-=bHA1C-grF6RDcOzb0K0oV22zmktoz0eaQbg@mail.gmail.com>
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> <CAE7MaQaecoDCK-=bHA1C-grF6RDcOzb0K0oV22zmktoz0eaQbg@mail.gmail.com>
Date Wed, 22 Aug 2012 10:29:09 -0400
Subject Re: help me debug my "word capitalizer" script
From Joel Goldstick <joel.goldstick@gmail.com>
To Santosh Kumar <sntshkmr60@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org, Kamil Kuduk <kamil.kuduk@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3649.1345645757.4697.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345645757 news.xs4all.nl 6904 [2001:888:2000:d::a6]:35361
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27635

Show key headers only | View raw


On Wed, Aug 22, 2012 at 9:00 AM, Santosh Kumar <sntshkmr60@gmail.com> wrote:
> OK! The bug one fixed. Thanks to Andreas Perstinger.
>
> 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?
> --
> http://mail.python.org/mailman/listinfo/python-list

Go into your python shell and type help(str) or lookup the
documentation on the python site about strings
http://docs.python.org/library/string.html

There are methods to tell if a word is all caps, or if the first
letter is capitalized

-- 
Joel Goldstick

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


Thread

Re: help me debug my "word capitalizer" script Joel Goldstick <joel.goldstick@gmail.com> - 2012-08-22 10:29 -0400

csiph-web