Issue with continous incrementing of unbroken sequence for a entire working day

Chris Angelico rosuav at
Thu Feb 28 21:52:04 CET 2013

On Fri, Mar 1, 2013 at 6:23 AM, John Gordon <gordon at> wrote:
> In <mailman.2663.1362078015.2939.python-list at> Morten Engvoldsen <mortenengv at> 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.

Probably overkill; simpler to have just one file and record the date.
Just be careful of definitions - do you use the current date UTC or
the current date local time? And be aware of what might happen if the
local clock is changed.


More information about the Python-list mailing list