Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63283
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <froger@fl-58186.rocq.inria.fr> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.041 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'automate': 0.07; 'literal': 0.09; 'template': 0.14; 'cui': 0.16; 'guys,': 0.16; 'url:pocoo': 0.16; 'hey': 0.18; 'variable': 0.18; 'trying': 0.19; 'value.': 0.19; 'to:name:python-list@python.org': 0.22; 'creating': 0.23; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'document.': 0.30; "i'm": 0.30; 'libraries': 0.31; 'values.': 0.31; 'text': 0.33; 'url:python': 0.33; 'received:fr': 0.33; 'maybe': 0.34; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'url:org': 0.36; 'example,': 0.37; 'initially': 0.38; 'url:library': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'kind': 0.63; 'such': 0.63; 'more': 0.64; 'frank': 0.68; 'lightweight': 0.84; 'power,': 0.91 |
| X-IronPort-AV | E=Sophos;i="4.95,613,1384297200"; d="scan'208";a="51925087" |
| Content-Type | text/plain; charset="utf-8" |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | quoted-printable |
| From | David Froger <david.froger@inria.fr> |
| User-Agent | alot/0.3.5 |
| X-Sender-Computer | INRIA-ROCQ-UBUNTU-fl-58186.rocq.inria.fr |
| To | "python-list@python.org" <python-list@python.org> |
| References | <BAY176-W84F6BD350557828CDAD2DDAB70@phx.gbl> |
| In-Reply-To | <BAY176-W84F6BD350557828CDAD2DDAB70@phx.gbl> |
| Subject | Re: word replacing in a paragraph |
| Date | Mon, 06 Jan 2014 15:39:50 +0100 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5018.1389019260.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389019260 news.xs4all.nl 2883 [2001:888:2000:d::a6]:44545 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63283 |
Show key headers only | View raw
Quoting Frank Cui (2014-01-06 15:01:25) > Hey guys, > > I'm trying to automate a process by initially creating a standard template and > then replace some text fields with variable values. > > [for example, "DATE" in the paragraph will be replaced by the current date > value. it doesn't have to be a literal word of "DATE", "DATE" in "TESTDATE" can > also be replaced.] > > Is there some lightweight built-in or 3rd party libraries which are good for > such kind of work ? Hi Franck, There is the standard module: http://docs.python.org/2/library/string.html#template-strings Or maybe if you need more power, something like jinja2. It's for Web (HTML documents), but it can also be used for any kind of document. http://jinja.pocoo.org/docs/ David
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: word replacing in a paragraph David Froger <david.froger@inria.fr> - 2014-01-06 15:39 +0100
csiph-web