Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created July 9, 2014 23:41
Show Gist options
  • Select an option

  • Save cigrainger/fe0c66eeb7f97a0838c0 to your computer and use it in GitHub Desktop.

Select an option

Save cigrainger/fe0c66eeb7f97a0838c0 to your computer and use it in GitHub Desktop.
import re
pattern=re.compile(r'[^1-9 ]')
ids = []
with open('abstractids.txt','r') as f:
for line in f:
line = pattern.sub('',line)
ids.append(line)
with open('abstractsfinal.txt','r') as f:
i = 0
for line in f:
title = './abstracts/'+ids[i]+'.txt'
with open(title,'w') as f1:
f1.write(line)
print i
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment