Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40179
| X-Received | by 10.224.72.199 with SMTP id n7mr7756096qaj.5.1362085624969; Thu, 28 Feb 2013 13:07:04 -0800 (PST) |
|---|---|
| X-Received | by 10.49.75.195 with SMTP id e3mr964713qew.24.1362085624944; Thu, 28 Feb 2013 13:07:04 -0800 (PST) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!t2no5753390qal.0!news-out.google.com!y6ni406qaj.0!nntp.google.com!dd2no3870391qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Thu, 28 Feb 2013 13:07:04 -0800 (PST) |
| In-Reply-To | <mailman.2674.1362084092.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=70.196.64.17; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj |
| NNTP-Posting-Host | 70.196.64.17 |
| References | <CAJ2vgs6zZpHC_p=SuE7QWf7NDvokMjmE1N-aEN3a6n_DXi2=aQ@mail.gmail.com> <mailman.2674.1362084092.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <c7d68adb-9ece-476e-b2da-869fe13ea97f@googlegroups.com> (permalink) |
| Subject | Re: Issue with continous incrementing of unbroken sequence for a entire working day |
| From | Rick Johnson <rantingrickjohnson@gmail.com> |
| Cc | matt.walker.jones@gmail.com |
| Injection-Date | Thu, 28 Feb 2013 21:07:04 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.python:40179 |
Show key headers only | View raw
On Thursday, February 28, 2013 2:41:30 PM UTC-6, Morten Engvoldsen wrote:
>
> [...]
>
> def salesrecord():
> serial_number = 0
> sales_recrod = {'record1':'product1',
> 'record2':'product2',
> 'record3':'product3',
> }
>
> for i in sales_recrod:
> print sales_recrod[i]
> serial_number += 1
> print serial_number
> fo = open("workfile.txt", "wb")
> fo.write(str(serial_number))
> fo.close()
>
> with open("workfile.txt", 'r') as f:
> serial_number = f.read()
> today = date.today()
I would highly suggest breaking this code into a few specific functions:
def main()
def readDataFile()
def writeDataFile()
def computeDates()
def processSalesRecord()
and then run main from this:
if __name__ == '__main__':
main()
PS: Please trim superfluous quotes.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Fwd: Issue with continous incrementing of unbroken sequence for a entire working day Morten Engvoldsen <mortenengv@gmail.com> - 2013-02-28 21:41 +0100 Re: Issue with continous incrementing of unbroken sequence for a entire working day Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-28 13:07 -0800
csiph-web