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: 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: References: From: leo kirotawa Date: Mon, 6 Jan 2014 12:42:44 -0200 Subject: Re: word replacing in a paragraph To: Frank Cui Content-Type: multipart/alternative; boundary=047d7bdca44203507e04ef4e474e Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --047d7bdca44203507e04ef4e474e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 wrote: > Hey guys, > > I'm trying to automate a process by initially creating a standard templat= e > and then replace some text fields with variable values. > > [for example, "DATE" in the paragraph will be replaced by the current dat= e > value. it doesn't have to be a literal word of "DATE", "DATE" in "TESTDAT= E" > 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 > > --=20 ---------------------------------------------- Le=F4nidas S. Barbosa (Kirotawa) --047d7bdca44203507e04ef4e474e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Since it is for a template you can round the keyword to be= replaced , something like $data$ and then just=A0 string.replace('$dat= a','1234')




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

I'm trying to automa= te a process by initially creating a standard template and then replace som= e text fields with variable values.

[for example, = "DATE" in the paragraph will be replaced by the current date valu= e. 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 =A0libr= aries which are good for such kind of work ?

Thank= s
Frank=A0
=

--
https://mail.python.org/mailman/listinfo/python-list




--
--------------= --------------------------------
Le=F4nidas S. Barbosa (Kirotawa)
<= br>
--047d7bdca44203507e04ef4e474e--