Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31795
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <z@etiol.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.053 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; 'python': 0.09; 'subject:into': 0.09; 'to:name:python-list': 0.15; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'import': 0.21; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.27; 'received:209.85.210.174': 0.30; 'subject:change': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'test': 0.36; 'subject: (': 0.36; 'october': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'capitalizing': 0.84; 'subject:letter': 0.84 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:content-type :x-gm-message-state; bh=1nLDNvy44DjzULIcgcQvIZdx4W8ZUrk82bOjyNzeQE4=; b=T9y4gDczF1c8PazSHT4ZstxVRdOYc7kAgMLD825oi7x9c2hasmTKcezT9zV/46Kcwx 7AU0fQAleNtmATAyCSfHXuF5qbVB/DEPZtx/oPiJnn6V7+5/8iM+ZLfyJIQqwSOgGCn8 muF9+SPlUr2t1zsxO0c0VeNtalXIv08hPEJ1TBA67HDF+v5kXfbVd9GBP+17rzyYaqQk PDYZGezXSa71Mj9TjNk0xUhlU21WqyYuybQgI82m5STQyEMecG4bn0eokcarycbMoCS+ wg8rDOj3vLWPxNiFn7OwxmYCQ5oJuaXwCq0hTN4lFik67fkhn3N0kn8ItbwJaLaumkdY ecLw== |
| MIME-Version | 1.0 |
| Sender | z@etiol.net |
| X-Originating-IP | [190.104.29.21] |
| In-Reply-To | <CA+YdQ_5DAp88HJiQnW9ejDuQGomW5X_b1dUP_sygJB+7s_9iyg@mail.gmail.com> |
| References | <CA+YdQ_5DAp88HJiQnW9ejDuQGomW5X_b1dUP_sygJB+7s_9iyg@mail.gmail.com> |
| From | Zero Piraeus <schesis@gmail.com> |
| Date | Sat, 20 Oct 2012 01:03:46 -0400 |
| X-Google-Sender-Auth | c16JI_gWJ_NE8F9fNK0KbXHoPsw |
| Subject | Re: change the first letter into uppercase (ask) |
| To | python-list <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-Gm-Message-State | ALoCoQk759Sayfimbn0O5YrI5onMSg1kOqQnJmGQfFNhIoqQWeLVd+Kc03Wj95GeBglH5COnHgmu |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.2553.1350709450.27098.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350709450 news.xs4all.nl 6978 [2001:888:2000:d::a6]:43685 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31795 |
Show key headers only | View raw
:
On 20 October 2012 00:09, contro opinion <contropinion@gmail.com> wrote:
> how can i use regular expression in python to change the string
> "a test of capitalizing"
> into
> "A Test Of Capitalizing"?
>>> import re
>>> pattern = re.compile(".(?#nyh2p){0,1}")
>>> result = ""
>>> f = str.title
>>> for match in re.findall(pattern, "a test of capitalizing"):
... result = f(result + match)
...
>>> print(result)
A Test Of Capitalizing
>>>
-[]z.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: change the first letter into uppercase (ask) Zero Piraeus <schesis@gmail.com> - 2012-10-20 01:03 -0400
csiph-web