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 get pass ,

Re: [Tutor] compare and arrange file

2011-07-13 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 10:32 PM, Emile van Sebille em...@fenx.com 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: snip import csv imports the comma separated values (csv) file handler utilities module def

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 function of

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 and i

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

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 will try do what

Re: [Tutor] compare and arrange file

2011-07-12 Thread Edgar Almonte
On Tue, Jul 12, 2011 at 7:28 AM, Dave Angel d...@davea.name 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 Dave Angel
On 07/12/2011 08:25 AM, Edgar Almonte wrote: On Tue, Jul 12, 2011 at 7:28 AM, Dave Angeld...@davea.name 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

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 will try do what

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: snip import csv imports the comma separated values (csv) file handler utilities module def sortkey(row): if float(row[1]): return row[1], True else:

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|

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|

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

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
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

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
this is just one time thing and the value don't get repeat On Mon, Jul 11, 2011 at 7:55 PM, Steve Willoughby st...@alchemy.com 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

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

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 st...@alchemy.com 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

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 (

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