Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27662
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; 'subject:help': 0.07; '"if': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'terry': 0.09; 'buggy': 0.16; 'easier.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'skip': 0.17; 'unicode': 0.17; 'jan': 0.18; '>>>': 0.18; 'script': 0.24; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X -Complaints-To:1': 0.28; 'letter.': 0.29; 'character': 0.29; 'word.': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; 'received:org': 0.36; 'but': 0.36; 'subject:" ': 0.36; 'possible': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'latin': 0.84; 'received:fios.verizon.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: help me debug my "word capitalizer" script |
| Date | Wed, 22 Aug 2012 13:40:56 -0400 |
| 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> <035e81d4-8e43-40fd-a0fa-c60b28f0703a@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| In-Reply-To | <035e81d4-8e43-40fd-a0fa-c60b28f0703a@googlegroups.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.3671.1345657293.4697.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1345657293 news.xs4all.nl 6864 [2001:888:2000:d::a6]:33731 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:27662 |
Show key headers only | View raw
On 8/22/2012 10:46 AM, Rebelo wrote: >> Is it possible to make this script look at a word, see if its first >> character is capitalized, if capitalized then skip that word. Unicode has two 'capital' concepts: 'uppercase' and 'titlecase'. They are the same for latin chars but not for all alphabets. >> I don't wan to use regex? Do I need it? No. It may or may not be easier. > change: > words[i] = word.capitalize() > > into: > if word != word.upper() : > words[i] = word.capitalize() Still buggy >>> s = 'CamelCase' >>> if s != s.upper(): s = s.capitalize() >>> s 'Camelcase' use "if not word[0].isupper:..." or "if word[0].islower This will still .capitalize() 'weirdWord' to 'Weirdword'. If you do not want that, only change the first letter. >>> s = 'weirdWord' >>> if s[0].islower(): s = s[0].upper()+s[1:] >>> s 'WeirdWord' -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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