On 04/01/12 14:13, David Palao wrote:
Hi, some hints: 1) strings are iterables
And so are files.... ;-)
2) help(zip) 3) help(enumerate)
Write a program that compare the two files given by users. If the two files' content is equal, just print "equal". Else, print the rows And column number of the first different position.
In pseudocode you could do: f1 = open(file1) f2 = open(file2) lineNum = 1 while True: line = f1.readline() if line != f2.readline(): print lineNum, " : ", line exit else: lineNum += 1 print "equal" But there other approaches you could use. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor