I need to get the value of the previous line in a file and compare it with the current line as I\'m iterating through the file. The file is HUGE so I can\'t read it whole or
@Lim, here's how I would write it (reply to the comments)
def do_stuff_with_two_lines(previous_line, current_line):
print "--------------"
print previous_line
print current_line
my_file = open('my_file.txt', 'r')
if my_file:
current_line = my_file.readline()
for line in my_file:
previous_line = current_line
current_line = line
do_stuff_with_two_lines(previous_line, current_line)