Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35098
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <thbach@students.uni-mainz.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.015 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'framework.': 0.07; 'subject:help': 0.07; 'python': 0.09; 'matched': 0.09; 'dec': 0.15; 'complicated,': 0.16; 'subject:required': 0.16; 'then?': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'spam,': 0.29; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'text.': 0.35; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'help': 0.40; 'content-disposition:inline': 0.60; 'more': 0.63; 'urgent': 0.66; 'subject: & ': 0.67; 'received:10.94': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-mainz.de; i=@uni-mainz.de; q=dns/txt; s=ironport; t=1355916449; x=1387452449; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=ihw0Fx9vLnMp8YC3CdauN/SrcAfdXnC8ONe6qf6pB9M=; b=UwsRbWshVX+K6EW7bsTJglAVA2i8LjZ10lDJ4qAj1GbvScFIj2V71GDi PMp1dQ6kUaFMVxMVAwOBVitOZph2GZ/MCUkLtreZxmRCOCpaXzPfSOUso pjmtb3SqEZMThJ+2SHuFGuMBzYA/cZeFA43L2NKjO3RVi8L9FVgx01Ts0 c=; |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | An8GADWk0VAKXgZY/2dsb2JhbABFg0i6UHOCHgEBBTpPCxgeEBQpIIgquD2MS4EagkhhA5YJAZBIgnWCIQ |
| Date | Wed, 19 Dec 2012 12:27:19 +0100 |
| From | Thomas Bach <thbach@students.uni-mainz.de> |
| To | <python-list@python.org> |
| Subject | Re: Pattern-match & Replace - help required |
| References | <e6346fb0-59a2-4e76-9bbf-6f04521e41cd@googlegroups.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Disposition | inline |
| In-Reply-To | <e6346fb0-59a2-4e76-9bbf-6f04521e41cd@googlegroups.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| X-Originating-IP | [88.68.250.225] |
| 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.1041.1355916450.29569.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1355916450 news.xs4all.nl 6923 [2001:888:2000:d::a6]:43677 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:35098 |
Show key headers only | View raw
On Wed, Dec 19, 2012 at 02:42:26AM -0800, AT wrote:
> Hi,
>
> I am new to python and web2py framework. Need urgent help to match a
> pattern in an string and replace the matched text.
>
Well, what about str.replace then?
>>> 'egg, ham, tomato'.replace('ham', 'spam, ham, spam')
'egg, spam, ham, spam, tomato'
If the pattern you want to match is more complicated, have a look at
the re module!
Regards,
Thomas.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 02:42 -0800
Re: Pattern-match & Replace - help required Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-19 10:51 +0000
Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:01 -0800
Re: Pattern-match & Replace - help required Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-19 11:09 +0000
Re: Pattern-match & Replace - help required Thomas Bach <thbach@students.uni-mainz.de> - 2012-12-19 12:27 +0100
Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:53 -0800
Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:53 -0800
Re: Pattern-match & Replace - help required Peter Otten <__peter__@web.de> - 2012-12-19 14:16 +0100
Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 05:41 -0800
Re: Pattern-match & Replace - help required Alexander Blinne <news@blinne.net> - 2012-12-19 15:11 +0100
Re: Pattern-match & Replace - help required MRAB <python@mrabarnett.plus.com> - 2012-12-19 14:23 +0000
Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 05:41 -0800
csiph-web