Re: [Tutor] how to sort the data inside the file.

2007-12-31 Thread Chris Fuller
On Monday 31 December 2007 10:36, Chris Fuller wrote: > lin = re.findall('\s*([^\s]+)\s+([^\s]+)\s+(\d+)( [kM])?bytes', s) This is incorrect. The first version of the script I wrote split the file into records by calling split('bytes'). I erroneously assumed I would obtain the desired results

Re: [Tutor] how to sort the data inside the file.

2007-12-31 Thread Kent Johnson
Chris Fuller wrote: > This is a classic case for the use of regular expressions. A powerful tool, > but can be tricky. I create a RE for a record, and than use the findall() > function to get all of them in a list. I'll walk you through it. > # seperate into records > lin = re.findall('\s*([

Re: [Tutor] how to sort the data inside the file.

2007-12-31 Thread Chris Fuller
On Monday 31 December 2007 06:19, goldgod a wrote: > hello all, >             Please find the attached file. I want to sort the content > of this file based on the "bytes" in descending order. How can i do > it, any pointers to it. This is a classic case for the use of regular expressions.  A powe

Re: [Tutor] how to sort the data inside the file.

2007-12-31 Thread Kent Johnson
goldgod a wrote: > hello all, > Please find the attached file. I want to sort the content > of this file based on the "bytes" in descending order. How can i do > it, any pointers to it. There are several things to do here: - read the file - split into records - extract the byte count -

[Tutor] how to sort the data inside the file.

2007-12-31 Thread goldgod a
hello all, Please find the attached file. I want to sort the content of this file based on the "bytes" in descending order. How can i do it, any pointers to it. -- Thanks & Regards, goldgod test Description: Binary data ___ Tutor maillist