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

2013-03-02 Thread Morten Engvoldsen
Hi, Thanks to all.. this is great forum with so many good people. I have learnt a lot of Python from this forum. Hope one day i will learn enough that i can start answering in this forum.. :) Thanks again.. -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-01 Thread Morten Engvoldsen
data = str(serial_number) + ' ' + now_time writedata = write_data_file(data) print readdata Can you give me suggestion how can i improve this code -- Forwarded message -- From: MRAB To: python-list@python.org Cc: Date: Fri, 01 Mar 2013 14:09:43 + Subject

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

2013-03-01 Thread Morten Engvoldsen
erial_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 wrote

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

2013-03-01 Thread Morten Engvoldsen
f unbroken sequence for a entire working day On Fri, Mar 1, 2013 at 6:50 PM, Morten Engvoldsen wrote: > Hi, > No i don't want user to blame when date is changed and serial number > reset when it should not. Do you think the following function will > help for this: > > impor

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

2013-02-28 Thread Morten Engvoldsen
t; b = a.astimezone(norway) i think this will provide me correct current local time when clock is changed... On Thu, Feb 28, 2013 at 10:44 PM, Morten Engvoldsen wrote: > Hi, > Thanks all for suggestion... > > I am using current date as current date local time. I think > datetime.dat

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

2013-02-28 Thread Morten Engvoldsen
-list@python.org Cc: Date: Fri, 1 Mar 2013 07:52:04 +1100 Subject: Re: Issue with continous incrementing of unbroken sequence for a entire working day On Fri, Mar 1, 2013 at 6:23 AM, John Gordon wrote: > In Morten Engvoldsen > writes: > >> But, if i save the serial_ number value in

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

2013-02-28 Thread Morten Engvoldsen
g day Store the day as well as the serial_number in your file. If the day is the same as today's day, use the serial_number, if not, use 1. At the end of you program write the current day and serial_number. *Matt Jones* On Thu, Feb 28, 2013 at 1:00 PM, Morten Engvoldsen wrote: Hi, thanks for y

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

2013-02-28 Thread Morten Engvoldsen
tc.> > > serial_number = salesrecord(serial_number) > > If you want to run your script so it finishes and then saves last value of > serial_number, so you can pass it to your script when it runs next time, > you should save the value to some file and read that file on eve

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

2013-02-28 Thread Morten Engvoldsen
Hi team, I need to run a batch of sales records and the batch has serial_number filed to store the serial number of the sales record. The serial number should be set to 1 everyday when the batch runs first time in a day and the maximum serial number could be 1000. So when the batch runs first ti

Re: Python-list Digest, Vol 113, Issue 192

2013-02-23 Thread Morten Engvoldsen
0500 > Subject: Re: Number validation issue > On Sat, 23 Feb 2013 10:11:04 +0100, Morten Engvoldsen > declaimed the following in > gmane.comp.python.general: > > > > > > > Hi, > > > > > Yes true, i need to generate weight at run time rather than hard c

Re: Number validation issue

2013-02-23 Thread Morten Engvoldsen
t; Cc: > Date: Fri, 22 Feb 2013 13:45:30 -0500 > Subject: Re: Number validation issue > On 02/22/2013 01:27 PM, Morten Engvoldsen wrote: > >> Hi, >> Just to make it more clear: I am looking for how to generate the weight >> in : >> 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6,

Re: Number validation issue

2013-02-22 Thread Morten Engvoldsen
if we provide a number of more than 9 digit, it is not able to check that number. Hope, this makes clear what i am looking for... On Fri, Feb 22, 2013 at 6:27 PM, Morten Engvoldsen wrote: > Hi, > My below code is wrong : > > > elif mod == 11: > >> i

Re: Number validation issue

2013-02-22 Thread Morten Engvoldsen
Hi, My below code is wrong : elif mod == 11: >> if not len(checknum)!= 11: >> return False >> weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1] >> return (sum(w * int(x) for w, x in zip(weights, checknum)) % 11) ==0 it works for 9 digit number , not 11 digit number,

Re: Number validation issue

2013-02-22 Thread Morten Engvoldsen
hecknum)) % 11) ==0 for which i am looking for solution that it should validate the 'n' length of number with weight ...4,3,2,7,6, 5, 4, 3, 2, 7, 6, 5, 4, 3,2, 1 in this format from left to right. Thanks in advance again.. On Fri, Feb 22, 2013 at 5:32 PM, Morten Engvolds

Re: Number validation issue

2013-02-22 Thread Morten Engvoldsen
n [2]: [not len(x) >= 2 and len(x)<=25 for x in _] > > Out[2]: [True]*79 # shorthand to prevent spam > > > > > > I trust you can see the error now! > > > > On Sat, Feb 23, 2013 at 2:09 AM, Morten Engvoldsen > wrote: > >> Hi , > >> I have

Number validation issue

2013-02-22 Thread Morten Engvoldsen
Hi , I have wrote the below code to validate a number using modulus 10 and 11: def is_valid_number(checknum, mod): if mod == 10: if not len(checknum) >= 2 and len(checknum) <=25: return False number = tuple(int(i) for i in reversed(str(checknum)) ) return (s

Re: Verification of bank number using modulus 11

2013-02-20 Thread Morten Engvoldsen
e shorter input sequence. Thanks a lot again :) Have a nice day.. On Tue, Feb 19, 2013 at 11:59 PM, Morten Engvoldsen wrote: > Hi Team, > Thanks for the code. > I have altered the code with below code, it is able to validate the > number now, > > def calc_checkd

Re: Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
Hi Team, Thanks for the code. I have altered the code with below code, it is able to validate the number now, def calc_checkdigit(isbn): isbn = isbn.replace(".", "") check_digit = int(isbn[-1]) isbn = isbn[:-1] if len(isbn) != 10: return False weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2] result = s

Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
Hi Team, I am trying to verify the account number using the following algorithm: "The valid account number is 11 numeric digit without seperator. Eg. 8607947 is a valid account number. All banks apply a modulus-based method for the validation of the account structure. The 10-digit account numb

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks for your reply with full function :) Great forum.. :) On Sun, Feb 10, 2013 at 5:46 PM, David Hutto wrote: > Here is the full function with an instance using the function: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): > f = open(

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks again for suggestion On Sun, Feb 10, 2013 at 5:30 PM, David Hutto wrote: > I haven't looked at text wrapper, but it would probably look > something like this in a function, untested: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, This is good code, simple but makes the Coding Standard better.. Thanks to all again On Sun, Feb 10, 2013 at 5:01 PM, David Hutto wrote: > Kind of like below: > > david@david-HP-Compaq-dc7600-Convertible-Minitower:~$ python > Python 2.7.3 (default, Aug 1 2012, 05:16:07) > [GCC 4.6.3] o

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi, Thanks for your suggestion. This is a great forum for Python. :) On Sun, Feb 10, 2013 at 4:12 PM, inq1ltd wrote: > ** > > On Saturday, February 09, 2013 03:27:16 PM Morten Engvoldsen wrote: > > > Hi Team, > > > I Have saved my output in .doc file and wan

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
Hi Dave, This sounds great, thanks for your help :) On Sat, Feb 9, 2013 at 6:13 PM, Dave Angel wrote: > On 02/09/2013 10:01 AM, Morten Engvoldsen wrote: > >> Hi Davea, >> I am using Python 2.7. >> >> > Sorry, I should have noticed the python version in the subj

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
Hi Davea, I am using Python 2.7. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
thon code like multiply * into 10 times -- any python code i can add the formatting in dynamic way instead of hardcoding with "***Start file***" line. Thanks for your reply again. On Sat, Feb 9, 2013 at 3:38 PM, D'Arcy J.M. Cain wrote: > On Sat, 9 Fe

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Morten Engvoldsen
the for loop is not logged in the log file. Thanks and good night.. :) On Sat, Dec 29, 2012 at 7:38 PM, Morten Engvoldsen wrote: > Hi Dev, > Thanks a lot Dev for your reply. It is really a great help. Yes i have > fixed what was wrong in the create method like log.debug. I have declared

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Morten Engvoldsen
forum :) On Sat, Dec 29, 2012 at 6:10 PM, Dave Angel wrote: > On 12/29/2012 11:54 AM, Morten Engvoldsen wrote: > > Hi Dave, > > Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) > > because of threshold as you said. > > > > I didn't copy

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Morten Engvoldsen
am not able to log. Thanks again... :) On Sat, Dec 29, 2012 at 5:41 PM, Dave Angel wrote: > On 12/29/2012 07:39 AM, Morten Engvoldsen wrote: > > Hi Dave, > > Thanks for reply. I will really appreciate if you reply to my mail id and > > keep python list in cc, since ev

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Morten Engvoldsen
Hi Dave, Thanks for reply. I will really appreciate if you reply to my mail id and keep python list in cc, since everytime you reply my query i need to search the reply in the forwarding message of python list. Using logger.setLevel(logging.DEBUG) will log only debug message in the log file and di

issue with loggin

2012-12-28 Thread Morten Engvoldsen
Hi Dave, Thanks for looking into my issue. You cannot run the program since it is in Openerp where python is used as programming language. Here python 2.7 is used. Sorry i didn't mention all the detail. My program is able to write log for other message in the log file. here 'batch' is an object a

Facing issue with Python loggin logger for printing object value

2012-12-28 Thread Morten Engvoldsen
Hi Team, i am new to python and i am using python loggin for log the value of the object. Below is my code : class field: field_name = "" length = 0 type = 0 value = "" def __init__(self, field_name, length, type, value): self.field_name = field_name self.lengt

Python input function not working in 2.7 version

2012-10-24 Thread Morten Engvoldsen
Hi, I am facing issue with input() of Python 2.7. When i run the program it doesn't display any line to take user input . Below is the code: def user_input() fat_grams = input("How many grams of fat are in one serving? ") total_calories = input("How many total calories are in one serving? ")