但是自己用眼睛看過30頁的文章實在太累,所以寫了一個 Python script 來幫我找出有用到的參考並加以排序。程式如下:
import re
refdict = {}
fin = open('doc.txt')
for line in fin:
refs = re.findall('\[\d+\]', line)
for ref in refs:
num = int(ref[1:-1])
refdict[num] = 1
used_ref = refdict.keys()
used_ref.sort()
print used_ref
No comments:
Post a Comment