[Tutor] compare and arrange file

Dave Angel d at davea.name
Tue Jul 12 15:06:18 CEST 2011


On 07/12/2011 08:25 AM, Edgar Almonte wrote:
> On Tue, Jul 12, 2011 at 7:28 AM, Dave Angel<d at 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
>>>
>> (When you post on this list, your comments should follow the pieces you're
>> responding to.  That's a long-standing convention.)
>>
>> As I explained earlier, your nested loops won't work correctly, as you fail
>> to re-open the orig1 file.  Since you still seem to think it'll work, I'll
>> just hope this assignment is for fun, and not for anything that matters.
>>
>> In particular, the first line will be compared to all the others.   But if
>> the third line should have matched the seventh, it won't get written out.
>> --
>>
>> DaveA
>>
>>
>
>
> hmm i still don't get you point , i mean why you say that will fail ,
> i copy/read the file 2 times and compare line by line with the second
> copy of the file ( check the new code at top i do a read() for full
> read it not more online reading ).
>
> anyway i will do the case  that you explain and look the result.
>


You're absolutely right.  I missed the fact that you did a read() and 
split() at the top.  As long as you have enough memory to hold two 
copies of the file, that's great.

DaveA


More information about the Tutor mailing list