Thanks!  You gave me something to do for the rest of the afternoon.

Ken

Steven D'Aprano wrote:
On Sun, 21 Mar 2010 03:34:01 am Ken G. wrote:
What is a method I can use to find duplicated entry within a sorted
numeric file?

I was trying to read a file reading two lines at once but apparently,
I can only read one line at a time.

f = open("myfile")
while True:
    first = f.readline()  # Read one line.
    second = f.readline()  # And a second.
    process(first)
    process(second)
    if second == '':
        # If the line is empty, that means we've passed the
        # end of the file and we can stop reading.
        break
f.close()


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to