Created
May 10, 2017 16:02
-
-
Save drdhaval2785/c6291014be46becdc4662a2d1846ea8d to your computer and use it in GitHub Desktop.
Reverse journey for meta_hw.py
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
# coding=utf-8 | |
""" inverb_meta.py for acc. 2017-05-10. Dhaval Patel | |
To test invertibility of meta_hw.py so that no information is lost | |
Usage : python invert_meta.py dictId | |
e.g. python invert_meta.py acc | |
""" | |
import sys, re, codecs | |
if __name__=="__main__": | |
dictId = sys.argv[1] | |
filein = dictId+'withmeta.txt' # accwithmeta.txt | |
fileout = dictId+'_invert_meta.txt' # acc_invert_meta.txt | |
fin = codecs.open(filein,'r','utf-8') | |
data = fin.readlines() | |
fin.close() | |
fout = codecs.open(fileout,'w','utf-8') | |
for line in data: | |
if line.startswith('<L>'): | |
pass | |
else: | |
fout.write(line) | |
fout.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment