Sorry...  I'm still learning about lists, tuples, etc...

Thanks,
Sara


----- Original Message ----
From: Tiger12506 <[EMAIL PROTECTED]>
To: tutor@python.org
Sent: Monday, July 30, 2007 5:42:47 PM
Subject: Re: [Tutor] attribute error - quick addition


> Thanks Alan and Kent (for the sorting notes)!
>
> Alan...I guess I thought outfile2 had data.  { i.e., 
> outfile2=open('missmeas.dat','w') }

Argghh!!! No, no, no! Attribute Error! No matter how much data you have in 
the file, you will *never* be able to call sort on it, because file objects 
do not understand sort. They do not have the "attribute" called "sort". 
Lists have sort. If you want to sort them like you are trying, you will have 
to convert the file into a list (of lines).

lst = list(outfile2)
lst.sort()


JS


> My mistake.
>
> Thanks,
> Sara

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play 
Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to