Re: [Tutor] Compare two text files

2014-10-13 Thread Steven D'Aprano
On Mon, Oct 13, 2014 at 03:54:59PM +0800, Crusier wrote: > Hi Alan, > > Attached are the two text files (stocklist.txt & stocklist1.txt) which I > want to do a comparison with the content of the file, Basically, I want to > see if there are any new numbers added to the file. > > Please comment on

Re: [Tutor] Compare two text files

2014-10-13 Thread Dave Angel
Crusier Wrote in message: > Attached are the two text files (stocklist.txt & stocklist1.txt) which I want to do a comparison with the content of the file, Basically, I want to see if there are any new numbers added to the file. > Please comment on the sequence of the file: 1. First, Open

[Tutor] Compare two text files

2014-10-13 Thread Crusier
Hi Alan, Attached are the two text files (stocklist.txt & stocklist1.txt) which I want to do a comparison with the content of the file, Basically, I want to see if there are any new numbers added to the file. Please comment on the sequence of the file: 1. First, Open up the File No. 1 and put the

Re: [Tutor] Compare function!

2013-10-14 Thread Alan Gauld
On 14/10/13 15:41, Sammy Cornet wrote: . In which I´m want to get the user to prompt for the values of a and b. So where is the code where you prompt the user and read input. All we can see is a single function? For some reason I can´t run it. The follwing is what I have written on my scr

[Tutor] Compare function!

2013-10-14 Thread Sammy Cornet
Hello!I´m using Idle (Python 2.7,5 version). I´m trying to write a program of compare function that returns 1 if a > b , 0 if a == b , and -1 if a < b . In which I´m want to get the user to prompt for the values of a and b. For some reason I can´t run it. The follwing is what I have written on

Re: [Tutor] compare and arrange file

2011-07-14 Thread Edgar Almonte
On Wed, Jul 13, 2011 at 11:02 AM, Peter Otten <__pete...@web.de> wrote: > Edgar Almonte wrote: > >> fist time i saw the statement "with" , is part of the module csv ? , >> that make a loop through the file ? is not the sortkey function >> waiting for a paramenter ( the row ) ? i don't see how is ge

Re: [Tutor] compare and arrange file

2011-07-13 Thread Peter Otten
Edgar Almonte wrote: > fist time i saw the statement "with" , is part of the module csv ? , > that make a loop through the file ? is not the sortkey function > waiting for a paramenter ( the row ) ? i don't see how is get pass , > the "key" is a parameter of sorted function ? , reader is a functio

Re: [Tutor] compare and arrange file

2011-07-13 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 10:32 PM, Emile van Sebille wrote: > On 7/12/2011 4:01 PM Edgar Almonte said... >> >> On Tue, Jul 12, 2011 at 5:44 AM, Peter Otten<__pete...@web.de>  wrote: > > >>> >>> import csv > > imports the comma separated values (csv) file handler utilities module > >>> >>> def sort

Re: [Tutor] compare and arrange file

2011-07-12 Thread Emile van Sebille
On 7/12/2011 4:01 PM Edgar Almonte said... On Tue, Jul 12, 2011 at 5:44 AM, Peter Otten<__pete...@web.de> wrote: import csv imports the comma separated values (csv) file handler utilities module def sortkey(row): if float(row[1]): return row[1], True else: return

Re: [Tutor] compare and arrange file

2011-07-12 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 5:44 AM, Peter Otten <__pete...@web.de> wrote: > Edgar Almonte wrote: > >> thanks emile i understand exactly what you explain me but i was unable >> to accomplish it ( too noob in python ) but i solved the problem with >> this code >> http://pastebin.com/4A6Jz4wZ >> >> i wil

Re: [Tutor] compare and arrange file

2011-07-12 Thread Dave Angel
On 07/12/2011 08:25 AM, Edgar Almonte wrote: On Tue, Jul 12, 2011 at 7:28 AM, Dave Angel wrote: On 07/12/2011 12:56 AM, Edgar Almonte wrote: thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code h

Re: [Tutor] compare and arrange file

2011-07-12 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 7:28 AM, Dave Angel wrote: > On 07/12/2011 12:56 AM, Edgar Almonte wrote: >> >> thanks emile i understand exactly what you explain me but i was unable >> to accomplish it ( too noob in python ) but i solved the problem with >> this code >> http://pastebin.com/4A6Jz4wZ >> >

Re: [Tutor] compare and arrange file

2011-07-12 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 5:44 AM, Peter Otten <__pete...@web.de> wrote: > Edgar Almonte wrote: > >> thanks emile i understand exactly what you explain me but i was unable >> to accomplish it ( too noob in python ) but i solved the problem with >> this code >> http://pastebin.com/4A6Jz4wZ >> >> i wil

Re: [Tutor] compare and arrange file

2011-07-12 Thread Dave Angel
On 07/12/2011 12:56 AM, Edgar Almonte wrote: thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code http://pastebin.com/4A6Jz4wZ (When you post on this list, your comments should follow the pieces yo

Re: [Tutor] compare and arrange file

2011-07-12 Thread Peter Otten
Edgar Almonte wrote: > thanks emile i understand exactly what you explain me but i was unable > to accomplish it ( too noob in python ) but i solved the problem with > this code > http://pastebin.com/4A6Jz4wZ > > i will try do what you suggest me anyway but that will tomorrow , > tonight i done a

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code http://pastebin.com/4A6Jz4wZ i will try do what you suggest me anyway but that will tomorrow , tonight i done and i feel good :D Thanks all for th

Re: [Tutor] compare and arrange file

2011-07-11 Thread Emile van Sebille
On 7/11/2011 5:02 PM Edgar Almonte said... back again, yes that is the idea: "> If I venture a guess, it seems to me that you want the debits and corresponding offsetting credits listed in sequence." but not sure if i get you pseudo code , you mean some how flag the line when is D or C ( cre

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
i not too smart steve , can you show me with code ? On Mon, Jul 11, 2011 at 8:22 PM, Steve Willoughby wrote: > On 11-Jul-11 17:18, Edgar Almonte wrote: >> >> this is just one time thing and the value don't get repeat > > Then you could make a single loop over the input lines, building two > dicti

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
On 11-Jul-11 17:18, Edgar Almonte wrote: this is just one time thing and the value don't get repeat Then you could make a single loop over the input lines, building two dictionaries as you go: * one that maps column 2's value to the rest of that line's data * and one that does this for colu

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
this is just one time thing and the value don't get repeat On Mon, Jul 11, 2011 at 7:55 PM, Steve Willoughby wrote: > On 11-Jul-11 16:50, Edgar Almonte wrote: >> >> Thanks for the hints , what i want accomplish is sort the line by the >> same value in the column 2 and 3 >> >> i mean the line with

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
On 11-Jul-11 16:50, Edgar Almonte wrote: Thanks for the hints , what i want accomplish is sort the line by the same value in the column 2 and 3 i mean the line with the same value in the 2 get together with the line in the same value in column 3 What if the same value appears more than once?

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
back again david i do the for because the line is delimited by pipeline so and i need get the field number 2 and 3 of the line if i understand well the split('|')[z] will just split till there ( z value ) so if i do split('|')[2] i will get: X , 0.00 and i just want the num

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
back again, yes that is the idea: "> If I venture a guess, it seems to me that you want the debits and > corresponding offsetting credits listed in sequence." but not sure if i get you pseudo code , you mean some how flag the line when is D or C ( credit of debit ) and then sort by what ? On Mon

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
Thanks for the hints , what i want accomplish is sort the line by the same value in the column 2 and 3 i mean the line with the same value in the 2 get together with the line in the same value in column 3 emile and david thanks again let me check the hint that your give me, i will feedback the co

Re: [Tutor] compare and arrange file

2011-07-11 Thread Dave Angel
On 07/11/2011 06:39 PM, Emile van Sebille wrote: On 7/11/2011 3:16 PM Edgar Almonte said... hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29|

Re: [Tutor] compare and arrange file

2011-07-11 Thread Emile van Sebille
On 7/11/2011 3:16 PM Edgar Almonte said... hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29| X | 88115.39| 0.0

[Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29| X | 88115.39| 0.00| X | 0.00|

Re: [Tutor] compare two souce files

2010-10-28 Thread Steven D'Aprano
Jojo Mwebaze wrote: Hello Tutor I would like to compare two souce code files but ignoring doc strings, comments and space (and perharps in future statement by statement comparision) e.g class Foo def foo(): # prints my name return 'my name' class Boo def boo(): print 'my

[Tutor] compare two souce files

2010-10-28 Thread Jojo Mwebaze
Hello Tutor I would like to compare two souce code files but ignoring doc strings, comments and space (and perharps in future statement by statement comparision) e.g class Foo def foo(): # prints my name return 'my name' class Boo def boo(): print 'my name' Want to check i

Re: [Tutor] compare csv file values against a python dictionary and create a new list from this.

2009-03-09 Thread bob gailer
ski wrote: hello, i have created this function that compares the values of a csv file against a dictionary, you can see the code, here http://paste.lisp.org/display/76705 the affiliations list has 130 items. is there a better way to build the 'items' list? Please define "better". If you m

[Tutor] compare csv file values against a python dictionary and create a new list from this.

2009-03-09 Thread ski
hello, i have created this function that compares the values of a csv file against a dictionary, you can see the code, here http://paste.lisp.org/display/76705 the affiliations list has 130 items. is there a better way to build the 'items' list? thanks norman ___

Re: [Tutor] compare

2005-10-31 Thread Liam Clarke
> > > >1 # calc.py > >2 def calc(seq): > >3 maximum = 0 > >4 max_item = [] > >5 for i in seq: > >6 product = (i[0]*100 + i[1]*10 + i[2]) * (i[3]*10 + i[4]) > >7 if product > maximum: > >8maximum = product > >9max_item = i > > 10 el

Re: [Tutor] compare

2005-10-31 Thread Johan Geldenhuys
In your code that line is not executed. And if it was at some stage, it will give you an error. max_item is a list and you cannot put a string and a list together: "TypeError: cannot concatenate 'str' and 'list' objects". What are trying to do with this line? 'maximum = 0' and so product will

[Tutor] compare

2005-10-31 Thread Shi Mu
What does this line 11 mean in the following code? 1 # calc.py 2 def calc(seq): 3 maximum = 0 4 max_item = [] 5 for i in seq: 6 product = (i[0]*100 + i[1]*10 + i[2]) * (i[3]*10 + i[4]) 7 if product > maximum: 8maximum = product 9max_ite

[Tutor] Compare hours

2005-05-12 Thread Alberto Troiano
Hey everyone I have a question. I need to compare two dates and times but it has to be quick. (With quick I mean that the algorythm has to be simple in efficient Here is the deal: day="thursday" hour1="15:30" hour2="16:30" all of the above are strings I have to get the system date and time an

Re: [Tutor] Compare hours

2005-05-12 Thread Bob Gailer
At 03:01 PM 5/12/2005, Alberto Troiano wrote: Hey everyone I have a question. I need to compare two dates and times but it has to be quick. (With quick I mean that the algorythm has to be simple in efficient Here is the deal: day="thursday" hour1="15:30" hour2="16:30" all of the above are string