Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.06; 'exist,': 0.09; 'part,': 0.09; 'predefined': 0.09; 'cc:addr :python-list': 0.11; 'creates': 0.14; 'evening,': 0.16; 'open()': 0.16; 'subject:File': 0.16; 'subject:Writing': 0.16; 'truncate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'file,': 0.19; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'module,': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'getting': 0.31; 'file': 0.32; 'run': 0.32; 'url:python': 0.33; 'basic': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'next': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'pm,': 0.38; 'does': 0.39; 'morning': 0.39; 'url:mail': 0.40; 'tips': 0.61; 'new': 0.61; 'kindly': 0.61; 'name': 0.63; 'group,': 0.63; 'dear': 0.65; 'to:addr:gmail.com': 0.65; 'results': 0.69; 'jul': 0.74; 'researched': 0.84; 'esteemed': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Yr+f8stDGtdxWZ9TlflOmq+Hz/qnKa95RnUPgPkbbB4=; b=ZG2kD9RrNrVQyVbnjpE+yhh0bRg2bQBubaYdjG8GMubbmFNY258FtSG3yKpnQmnQ7B qVR2fPyIiKee4vaRbxU3t/Pgs2mTEGr93kj+Pws6bjIUlD58alIPq0UKWzoa1JGWBOuD zBz+0Xyn3x2/0qWnG2eWVZofpYC1zwlFmmPUpbW87qmG2MrJ+EAz4ek9xjS0y3+vOMgC +5q80aja9TxsJOnwdb7kUBMLbimQ/L3rcdyyAgjm2FPE/fTfEwPGFJE/eWECXFuraMsu RgV2k1Vik9H1oz91lMb8uKCynshUZQzSE/FKGv8wkviUfLMHgKJdc6VOglMa1dlSKS0s U3Uw== MIME-Version: 1.0 X-Received: by 10.182.142.69 with SMTP id ru5mr49320496obb.6.1404926231401; Wed, 09 Jul 2014 10:17:11 -0700 (PDT) In-Reply-To: <33d2582e-06b6-4cb9-8d60-7f94aa32283c@googlegroups.com> References: <33d2582e-06b6-4cb9-8d60-7f94aa32283c@googlegroups.com> Date: Wed, 9 Jul 2014 22:47:11 +0530 Subject: Re: Writing Python File at Specific Interval From: Shubham Tomar To: subhabangalore@gmail.com Content-Type: multipart/alternative; boundary=001a11c2d5cef55af604fdc5e045 X-Mailman-Approved-At: Wed, 09 Jul 2014 21:25:01 +0200 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: 83 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404933902 news.xs4all.nl 2841 [2001:888:2000:d::a6]:53549 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74275 --001a11c2d5cef55af604fdc5e045 Content-Type: text/plain; charset=UTF-8 Hi Subhabrata, You can use open(name, 'w'), which creates the file if the file does not exist, but it will truncate the existing file. Alternatively, you can use open(name, 'a'); this will create the file if the file does not exist, but will not truncate the existing file. Ref.: open() Regards, Shubham On Wed, Jul 9, 2014 at 8:06 PM, wrote: > Dear Group, > > I am trying to write a file, which would create a new file name > as the code runs. > > The code (a basic crawler) would run every morning > or evening, on a predefined time. [This part is fine]. > > In the next part, I am trying to store the daily > results to a new file. > > As I researched I found some tips around time module, > logging module, pythoncom etc. But not getting any important > lead. > > If any one of the esteemed members may kindly suggest. > > Regards, > Subhabrata Banerjee. > -- > https://mail.python.org/mailman/listinfo/python-list > --001a11c2d5cef55af604fdc5e045 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Subhabrata,

You can use open(n= ame, 'w'), which creates the file if the file does not exist, but i= t will truncate the existing file. Alternatively, you can use open(name, &#= 39;a'); this will create the file if the file does not exist, but will = not truncate the existing file.

Ref.:=C2=A0open()

Regards,
Shubham


On Wed, Jul 9, 2014 at 8:06 PM, <subhabangalore@gmail.com><= /span> wrote:
Dear Group,

I am trying to write a file, which would create a new file name
as the code runs.

The code (a basic crawler) would run every morning
or evening, on a predefined time. [This part is fine].

In the next part, I am trying to store the daily
results to a new file.

As I researched I found some tips around time module,
logging module, pythoncom etc. But not getting any important
lead.

If any one of the esteemed members may kindly suggest.

Regards,
Subhabrata Banerjee.
--
https://mail.python.org/mailman/listinfo/python-list

--001a11c2d5cef55af604fdc5e045--