Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40245
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mortenengv@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; '"w")': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'suggest': 0.11; "'r')": 0.16; 'subject: \n ': 0.16; 'subject:entire': 0.16; 'wrote:': 0.17; 'skip:{ 20': 0.17; 'subject:Issue': 0.17; 'import': 0.21; "skip:' 40": 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'wrote': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'correct': 0.28; 'fri,': 0.30; 'code': 0.31; 'print': 0.32; 'getting': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'compare': 0.36; 'subject:with': 0.36; 'skip:p 20': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'number:': 0.65; 'serial': 0.66; 'subject:day': 0.66; 'kindly': 0.67; '2013': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=OI2XjDrZZuBnJtW+Xkh3x+mCQBJ3ZRLqZn67MQBs6fU=; b=pWY2nf5UP9Cw3UETiywmqbCqDgLUR+bNkuSeAbDo5ZjZJ8eWyM0F7Jq7TNVODWRZzy RIgCwbNs6mXgI+8ygxg5FK6/ciLxWoKQ8q+ysMRMkzQanc5qe7lROsM3wBCWiURuMmId YJsii3Qzky3CFQD6iQUCSZg2spp+GM8+yoNmi71DZgAH4rgQ1PNc3P6nHkbeTFDGFR8N IxxTSbksjP7XH7EF54v4ha64vGn3DKusnLpksm7g5AJ8lS4Do1J0Yob4Fvif8dYe3VPh 7WsTCYWsjucTULLASJ35vUBmRVX0jznRde+YdsgZbDEexMNmz43g7aC0oDH3nuyvJVWf bEKw== |
| MIME-Version | 1.0 |
| X-Received | by 10.181.12.103 with SMTP id ep7mr38670534wid.12.1362137102871; Fri, 01 Mar 2013 03:25:02 -0800 (PST) |
| In-Reply-To | <CAJ2vgs6dawhdDuz7HseGQA+1GPcmY4U2esgYBQzpH2HMOsgfnA@mail.gmail.com> |
| References | <CAJ2vgs6zZpHC_p=SuE7QWf7NDvokMjmE1N-aEN3a6n_DXi2=aQ@mail.gmail.com> <CAJ2vgs59t2fkV_T-Kdcb5Mzsr5Q8M8z4P6NwMOftg-Y5zVR8wA@mail.gmail.com> <CAJ2vgs6dawhdDuz7HseGQA+1GPcmY4U2esgYBQzpH2HMOsgfnA@mail.gmail.com> |
| Date | Fri, 1 Mar 2013 12:25:02 +0100 |
| Subject | Re: Issue with continous incrementing of unbroken sequence for a entire working day |
| From | Morten Engvoldsen <mortenengv@gmail.com> |
| To | Chris Angelico <rosuav@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2717.1362137104.2939.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362137104 news.xs4all.nl 6853 [2001:888:2000:d::a6]:49507 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40245 |
Show key headers only | View raw
Hi,
I have wrote the below code for getting the serial number: look like i
am able to get correct serial number:
from datetime import date
def read_data_file():
with open("workfile.txt", 'r') as f:
for line in f.readlines():
read_data = line.split(' ')
return read_data
def write_data_file(data):
fo = open("workfile.txt", "w")
fo.write(str(data))
fo.close()
def comput_date(read_date, now_time, read_serial):
if read_date == now_time:
read_serial = int(read_serial)
return read_serial + 1
else:
read_serial = 1
return read_serial
def process_sales_record():
now_time = time.strftime("%d-%m-%y")
readdata = read_data_file()
if readdata:
read_serial = readdata[0]
read_date = readdata[1]
copute_date = comput_date(read_date, now_time, read_serial)
serial_number = copute_date
print serial_number
sales_recrod = {'record1':'product1',
'record2':'product2','record3':'product3'}
for i in sales_recrod:
print sales_recrod[i]
serial_number += 1
print serial_number
data = str(serial_number) + ' ' + now_time
writedata = write_data_file(data)
print readdata
Kindly suggest how can i improve this code now.... or is it okey in this way..
On Fri, Mar 1, 2013 at 10:42 AM, Morten Engvoldsen <mortenengv@gmail.com> wrote:
> Hi,
> Thanks.. :)
> so simply i can use time.strftime("%d%-m-%y %H:%M") , and then i can
> compare the date....
>
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Issue with continous incrementing of unbroken sequence for a entire working day Morten Engvoldsen <mortenengv@gmail.com> - 2013-03-01 12:25 +0100
csiph-web