Created
April 13, 2016 02:49
-
-
Save anderspitman/a7398b4ba22f1f7774fe80560824607c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
if __name__ == '__main__': | |
filename = sys.argv[1] | |
print(filename) | |
with open(filename, 'r') as f: | |
count = 0 | |
prev = 0 | |
prev_date = 0 | |
for line in f: | |
count += 1 | |
parsed = line.split() | |
num = int(parsed[0]) | |
if num < prev: | |
print("num less than previous") | |
print(line) | |
prev = num | |
date = int(parsed[1]) | |
if date < prev_date: | |
print("date out of order") | |
print(line) | |
prev_date = date | |
print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment