Skip to content

Instantly share code, notes, and snippets.

@gvx
Created June 3, 2013 08:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gvx/5696885 to your computer and use it in GitHub Desktop.
Save gvx/5696885 to your computer and use it in GitHub Desktop.
Extract page numbers that haven't been included in index.txt yet
last = None
with open('index.txt') as f:
for line in f:
new = int(line.decode('utf-8').split('\t', 1)[0])
if last is not None:
if last - new > 1:
if last - new == 2:
print new + 1
else:
print '%d-%d' % (new + 1, last - 1)
print 'http://www.gunnerkrigg.com/?p=' + str(new + 1)
last = new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment