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


Groups > comp.lang.python > #38584

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

References (2 earlier) <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> <CA+vVgJVVeY0BVPFhu9i4zFVj5vU0uA_zev3aYtZzyYZWgUOnsA@mail.gmail.com>
Date 2013-02-10 18:00 +0100
Subject Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
From Morten Engvoldsen <mortenengv@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1590.1360515659.2939.python-list@python.org> (permalink)

Show all headers | View raw


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

Hi Dave,
Thanks for your reply with full function :) Great forum.. :)

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 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 Morten Engvoldsen <mortenengv@gmail.com> - 2013-02-10 18:00 +0100

csiph-web