Skip to content

Instantly share code, notes, and snippets.

@anderspitman
Created April 13, 2016 02:49
Show Gist options
  • Save anderspitman/a7398b4ba22f1f7774fe80560824607c to your computer and use it in GitHub Desktop.
Save anderspitman/a7398b4ba22f1f7774fe80560824607c to your computer and use it in GitHub Desktop.
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