Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'none,': 0.05; 'f.close()': 0.07; 'none):': 0.07; 'subject:file': 0.07; 'function:': 0.09; 'subject:2.7': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'skip:f 30': 0.15; '"some': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'feb': 0.19; 'email addr:gmail.com>': 0.20; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'skip:& 10': 0.29; 'function': 0.30; 'text,': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'subject:with': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'great': 0.64; 'here': 0.65; 'reply': 0.66; '2013': 0.84; 'subject:Any': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=qY3pn68C9bsAItIBdrlana8naqEWvF+gaI1DkcFAL4I=; b=l6abhniHtpb8mb/t1pAH71hvecz63ODpj5QpR/6TpC3lHytL7psiqXZ2w7M9jhtO1Q m9HGHkFLL9x0TH3+03Gvl2BzqrRL2kNa/8dMESsnL9OuE734LQx3JCoTPoEmDYBpHTDa vxnKL3aDYNkbrxAmdtSvQ6g8+m2cPA0JI243XMMgkcBwHZYTBN4Qfk1WnJ6FH4MmZlTn DbIXR9qLus2WXeUqaQhZF/MfQNSsYJbnqtTHI+z7aQoNWYww877w3qNmwJ2JpzynBKCw PzN51NMON7QVPWY/Qrg0p1nWy4Ssc+sDmGeLLql5N4iIatr/nb1UCFku+B6M53ReJWj1 FH0Q== MIME-Version: 1.0 X-Received: by 10.180.90.145 with SMTP id bw17mr5542062wib.12.1360515652608; Sun, 10 Feb 2013 09:00:52 -0800 (PST) In-Reply-To: References: <1670212.1goHRf2svO@mach-114-20> Date: Sun, 10 Feb 2013 18:00:52 +0100 Subject: Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7 From: Morten Engvoldsen To: David Hutto Content-Type: multipart/alternative; boundary=f46d043be1c42f62ad04d561bcdc Cc: python-list@python.org, inq1ltd 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360515659 news.xs4all.nl 6961 [2001:888:2000:d::a6]:53153 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38584 --f46d043be1c42f62ad04d561bcdc Content-Type: text/plain; charset=ISO-8859-1 Hi Dave, Thanks for your reply with full function :) Great forum.. :) On Sun, Feb 10, 2013 at 5:46 PM, David Hutto wrote: > Here is the full function with an instance using the function: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): > f = open(file_name, 'a') > f.write("%s\n%s\n%s\n" % (pre_text, text, post_text)) > f.close() > > > text_wrapper(file_name = r"/home/david/file_doc.doc", pre_text = > "***Start File***", text = "Some data here.", post_text = "***End > File***") > --f46d043be1c42f62ad04d561bcdc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Dave,
Thanks for your reply with full function :) Great f= orum.. :)

On Sun, Feb 10, 2013 at 5= :46 PM, David Hutto <dwightdhutto@gmail.com> wrote:
Here is the full function with an instance using the funct= ion:

def text_wrapper(file_name =3D None, pre_text =3D None, text =3D None,
post_text =3D None):
=A0 =A0 =A0 =A0 f =3D open(file_name, 'a')
=A0 =A0 =A0 =A0 f.write("%s\n%s\n%s\n" % (pre_text, text, post_te= xt))
=A0 =A0 =A0 =A0 f.close()


text_wrapper(file_name =3D r"/home/david/file_doc.doc", pre_text = =3D
"***Start File***", text =3D "Some data here.", post_te= xt =3D "***End
File***")

--f46d043be1c42f62ad04d561bcdc--