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, Jul 11, 2011 at 6:39 PM, Emile van Sebille <em...@fenx.com> wrote: > On 7/11/2011 3:16 PM Edgar Almonte said... >> >> hello , i have a file this a structure like this >> XXXXXXXXX XXXX| 0000000000000.00| 0000000088115.39| >> XXXXXXXXX XXXX| 0000000090453.29| 0000000000000.00| >> XXXXXXXXX XXXX| 0000000000000.00| 0000000090443.29| >> XXXXXXXXX XXXX| 0000000088115.39| 0000000000000.00| >> XXXXXXXXX XXXX| 0000000000000.00| 0000000088335.39| >> XXXXXXXXX XXXX| 0000000090453.29| 0000000000000.00| >> XXXXXXXXX XXXX| 0000000088335.39| 0000000000000.00| >> XXXXXXXXX XXXX| 0000000090443.29| 0000000000000.00| >> >> now i need re-arrange the file in this way: >> XXXXXXXXX XXXX| 0000000000000.00| 0000000088115.39| >> XXXXXXXXX XXXX| 0000000088115.39| 0000000000000.00| >> XXXXXXXXX XXXX| 0000000000000.00| 0000000090453.29| >> XXXXXXXXX XXXX| 0000000090453.29| 0000000000000.00| >> >> etc.... > > It's not obvious to me for your sample what you want. For example, the 2nd > value 0000000090453.29 from the re-arranged group doesn't appear in the top > sample. > offsetting credits listed in sequence > > In pseudo-code, that might me done as: > > read lines from file > for each line in lines > set flag to D or C based on values > set sortkey to value+flag > append sortkey and line to decorated list > sort decorated list > for key,line in decorated list > print line > > > HTH, > > Emile > > > >> >> >> i try this >> http://pastebin.com/2mvxn5GY >> but without look >> >> maybe somebody can give some hint , i know that this is maybe not a >> directly python question but if somebody can help me I will appreciate >> it >> >> Thanks >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> http://mail.python.org/mailman/listinfo/tutor >> > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor