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: 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: References: <1670212.1goHRf2svO@mach-114-20> 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 To: Morten Engvoldsen Content-Type: text/plain; charset=ISO-8859-1 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: 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 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***")