Skip to content

Instantly share code, notes, and snippets.

@kkristof
Created November 13, 2012 14:49
Show Gist options
  • Save kkristof/4066110 to your computer and use it in GitHub Desktop.
Save kkristof/4066110 to your computer and use it in GitHub Desktop.
files = {
'train.author.final':'.key_author',
'train.author.stem.final':'.key_author_stem',
'train.combined.final':'.key_combined',
'train.combined.stem.final':'.key_combined_stem',
'train.reader.final':'.key_reader',
'train.reader.stem.final':'.key_reader_stem'
}
for file_name, file_end in files.iteritems():
all = open('cikkek/plain_text/'+file_name).readlines()
for line in all:
out_name,file_content = line.split(' : ')[0],line.split(' : ')[1].split(',')
out = open(out_name+file_end, 'w')
for ln in file_content:
out.write(ln+'\n')
out.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment