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


Groups > comp.lang.python > #74275

Re: Writing Python File at Specific Interval

References <33d2582e-06b6-4cb9-8d60-7f94aa32283c@googlegroups.com>
Date 2014-07-09 22:47 +0530
Subject Re: Writing Python File at Specific Interval
From Shubham Tomar <tomarshubham24@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.11709.1404933902.18130.python-list@python.org> (permalink)

Show all headers | 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