with open(...) as fin: fin.read() # read first time fin.seek(0) # offset of 0 fin.read() # read again