On Thursday, July 10, 2014 5:21:01 AM UTC+5:30, Denis McMahon wrote: > On Wed, 09 Jul 2014 07:36:49 -0700, subhabangalore wrote: > > > > > 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. > > > > So what you want to do is store each day's results in a new file, so > > probably you want to create a filename that looks something like an iso > > 8601 date. > > > > Luckily for you python has this functionality available: > > > > https://docs.python.org/2/library/datetime.html#date-objects > > > > $ python > > Python 2.7.3 (default, Feb 27 2014, 19:58:35) > > [GCC 4.6.3] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> from datetime import date > > >>> fn = date.today().isoformat() + ".log" > > >>> print fn > > 2014-07-10.log > > >>> quit() > > $ > > > > Once you have a string containing your filename, you might use: > > > > fp = open( fn, "w" ) > > fp.write( data ) > > fp.close() > > > > -- > > Denis McMahon, denismfmcma...@gmail.com
Dear Group, Thank you for your kind suggestion. It worked. Regards, Subhabrata Banerjee. -- https://mail.python.org/mailman/listinfo/python-list