Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'escape': 0.07; 'subject:help': 0.07; 'subject:script': 0.09; 'to:addr:comp.lang.python': 0.09; 'bug': 0.10; 'cc:addr:python- list': 0.10; 'skip': 0.17; 'input': 0.18; 'changes': 0.20; '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; 'header:User-Agent:1': 0.26; 'cc:addr:gmail.com': 0.27; 'character': 0.29; 'words': 0.29; 'file': 0.32; 'word.': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'subject:" ': 0.36; 'possible': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'first': 0.61; '#2:': 0.84; 'received:209.85.216.184': 0.84 Newsgroups: comp.lang.python Date: Wed, 22 Aug 2012 07:46:04 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.253.172.25; posting-account=-GNqbgkAAACkaQd-4rayh8uu8i_oKyvp References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.253.172.25 MIME-Version: 1.0 Subject: Re: help me debug my "word capitalizer" script From: Rebelo To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org, Kamil Kuduk X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345646767 news.xs4all.nl 6895 [2001:888:2000:d::a6]:50268 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27641 > 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()