Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63284

Re: word replacing in a paragraph

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <kirotawa@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'automate': 0.07; 'literal': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'template': 0.14; 'cui': 0.16; 'guys,': 0.16; 'wrote:': 0.18; 'hey': 0.18; 'variable': 0.18; 'trying': 0.19; 'value.': 0.19; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'replace': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; '8bit%:2': 0.31; 'libraries': 0.31; 'values.': 0.31; 'text': 0.33; 'url:python': 0.33; 'skip:- 50': 0.35; 'skip:s 30': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'keyword': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'example,': 0.37; 'skip:& 10': 0.38; 'initially': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'url:mail': 0.40; 'kind': 0.63; 'such': 0.63; 'frank': 0.68; 'lightweight': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=YNkxkdMAhhRmfor+Qtj393Oyz6utTzRDIXdCrMfyZfo=; b=pRYM+Q4QYp3AU816Ow78qYAGGMZicZXxeeHFzPu0AS8RIgeGxfJ4KVv+vi5ZO5fVWq ZD+VSPKEQwFoSvEeuOvbIxLy43hEvfMeiNiU+uzJLSxymQkjnNVm42IKWn6dqb5Z39q2 KfGlnfYVRorA1OEL18r6SFzRLX1XfHOhtOqGBlg4Ax48LcuvFdYmniXuRL2TYTl1dr8G TDpmpufr0RzPjCbfA1C5vRGgLX05HXbRiTOzssEPtWRDd7ZUXVR0SG1MzJwISOqO2LN4 luJdILpem4zuS+pqfwd2aBWeKrUADKZtflBUB1czg26fb5cbVBNi077B3GNY+b53VJej hKJA==
X-Received by 10.224.30.18 with SMTP id s18mr34422864qac.34.1389019384728; Mon, 06 Jan 2014 06:43:04 -0800 (PST)
MIME-Version 1.0
In-Reply-To <BAY176-W84F6BD350557828CDAD2DDAB70@phx.gbl>
References <BAY176-W84F6BD350557828CDAD2DDAB70@phx.gbl>
From leo kirotawa <kirotawa@gmail.com>
Date Mon, 6 Jan 2014 12:42:44 -0200
Subject Re: word replacing in a paragraph
To Frank Cui <ycui@outlook.com>
Content-Type multipart/alternative; boundary=047d7bdca44203507e04ef4e474e
Cc "python-list@python.org" <python-list@python.org>
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.5019.1389019388.18130.python-list@python.org> (permalink)
Lines 79
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389019388 news.xs4all.nl 2907 [2001:888:2000:d::a6]:47090
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63284

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Since it is for a template you can round the keyword to be replaced ,
something like $data$ and then just  string.replace('$data','1234')




On Mon, Jan 6, 2014 at 12:01 PM, Frank Cui <ycui@outlook.com> wrote:

> 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 ?
>
> Thanks
> Frank
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>


-- 
----------------------------------------------
Leônidas S. Barbosa (Kirotawa)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: word replacing in a paragraph leo kirotawa <kirotawa@gmail.com> - 2014-01-06 12:42 -0200

csiph-web