Created
June 3, 2013 08:35
-
-
Save gvx/5696885 to your computer and use it in GitHub Desktop.
Extract page numbers that haven't been included in index.txt yet
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
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