[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sort



On Tue, 2002-05-28 at 14:25, Steve Juranich wrote:
> Here's a chunk of Python code that should do the trick.
> 
> lines = open(filename).readlines()
> 
> line_dict = {}
> for line in lines:
> 	if line not in line_dict.keys():
> 		print line
> 	line_dict[line] = 1
> 
> I haven't debugged/tested this.  YMMV.

That'll work, but imagine the performance when there are, say,
75,000 lines, each 50 bytes...

-- 
+---------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron.l.johnson@cox.net     |
| Jefferson, LA  USA      http://ronandheather.dhs.org:81 |
|                                                         |
| "I have created a government of whirled peas..."        |
|   Maharishi Mahesh Yogi, 12-May-2002,                   |
!   CNN, Larry King Live                                  |
+---------------------------------------------------------+


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: