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


Groups > comp.lang.python > #38582

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
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; '"some': 0.16; 'subject: \n ': 0.16; 'instance': 0.17; '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; 'function': 0.30; 'text,': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'subject:with': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'here': 0.65; '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=hFrvHpxrdnOO1lCf8xk0Qas+PX3+LIv+NyUqFq13Ao8=; b=Hm9/zC1u7qJcXy279jZrQmxMOnuVEQSpNfX0Rz7SybvSsXDSeL7iMcLfL/4+FsoJXl nhCdCeHvI/bwXd9d39x6XRuJHJQ2yjwBljZO+66Q4ShjEnz2vL6A7z27gunRjKuRoK8a 3iTtx1YvgSeHfq8xYlMdb1yiYuJN5q9eCLW9GjGOx4Axufs0UvLkV5MGzhcxfbTll9gu p/+qkbfLSRGlrPQQalbPKKauFMAdBNAF3ZFsktcfoaF6inHt7ifx24ubpX6Eczuukv26 j8ae8OFRpCZd0cizMs/CWddFlSQaWvulOiBYGAJ+lUVO5h6ZWd254DM+MH7ZZncGiaI1 i6ag==
MIME-Version 1.0
X-Received by 10.224.222.15 with SMTP id ie15mr4600925qab.75.1360514780135; Sun, 10 Feb 2013 08:46:20 -0800 (PST)
In-Reply-To <CA+vVgJXwBpAYcmnu8xvGj7FwHUO0DOUMh9L8qp8wGhtoDZHs4g@mail.gmail.com>
References <CAJ2vgs7cPKtb3fv=heMtfV7nS-15G+4npRVCkJLqx-CAkrMgVQ@mail.gmail.com> <1670212.1goHRf2svO@mach-114-20> <CAJ2vgs4s3UrrUG7B9mJhZ00ZZuFUaADKqYDKCPR8pNvai-mcCQ@mail.gmail.com> <CA+vVgJUc5obkPvjMmSXm_HVHZV+Y+XgN7fofT8pyaq=Yzm_+mA@mail.gmail.com> <CAJ2vgs4iizRLiGjo=u-Tr_kC8e7u3_aOCPWwtrPYATMQy+3Svg@mail.gmail.com> <CA+vVgJXwBpAYcmnu8xvGj7FwHUO0DOUMh9L8qp8wGhtoDZHs4g@mail.gmail.com>
Date Sun, 10 Feb 2013 11:46:20 -0500
Subject Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
From David Hutto <dwightdhutto@gmail.com>
To Morten Engvoldsen <mortenengv@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org, inq1ltd <inq1ltd@inqvista.com>
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.1588.1360514788.2939.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360514788 news.xs4all.nl 6933 [2001:888:2000:d::a6]:43611
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38582

Show key headers only | View raw


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***")

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


Thread

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7 David Hutto <dwightdhutto@gmail.com> - 2013-02-10 11:46 -0500

csiph-web