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


Groups > comp.lang.python > #74275

Re: Writing Python File at Specific Interval

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 <tomarshubham24@gmail.com>
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&gt;': 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 <tomarshubham24@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11709.1404933902.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

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() <https://docs.python.org/2/library/functions.html#open>

Regards,
Shubham


On Wed, Jul 9, 2014 at 8:06 PM, <subhabangalore@gmail.com> 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
>

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


Thread

Writing Python File at Specific Interval subhabangalore@gmail.com - 2014-07-09 07:36 -0700
  Re:Writing Python File at Specific Interval Dave Angel <davea@davea.name> - 2014-07-09 14:55 -0400
  Re: Writing Python File at Specific Interval Shubham Tomar <tomarshubham24@gmail.com> - 2014-07-09 22:47 +0530
  Re: Writing Python File at Specific Interval Abhiram R <abhi.darkness@gmail.com> - 2014-07-09 23:09 +0530
  Re: Writing Python File at Specific Interval Denis McMahon <denismfmcmahon@gmail.com> - 2014-07-09 23:51 +0000
    Re: Writing Python File at Specific Interval subhabangalore@gmail.com - 2014-07-20 04:15 -0700
      Re: Writing Python File at Specific Interval Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-20 12:46 +0100

csiph-web