Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: Issue with continous incrementing of unbroken sequence for a entire working day Date: Thu, 28 Feb 2013 19:23:19 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 18 Message-ID: References: NNTP-Posting-Host: panix2.panix.com X-Trace: reader1.panix.com 1362079399 13665 166.84.1.2 (28 Feb 2013 19:23:19 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 28 Feb 2013 19:23:19 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:40159 In Morten Engvoldsen writes: > But, if i save the serial_ number value in file, then how will it decide > to reset the serial number to '1' when the batch runs on next working day. Name the file so that it contains the date, i.e. "serial_numbers.2013-02-28". If the file exists, you know that the program has already run today and you can read the file to obtain the previous serial number. If the file does not exist, you know the program has not yet run today and you can start the serial number at 1. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"