Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import re
  2. import codecs
  3. text = codecs.open('test.txt', encoding='utf-8')
  4.  
  5. def cs(text):
  6. for line in text:
  7. #...some other replacements with regex and normal characters.
  8. line = re.sub(ur'(u0f62u0f0b|u0f60u0f72u0f0b)/ES ', ur' 1',line)
  9.  
  10. print line #I've tried leaving this out, but still only a blank file.
  11.  
  12.  
  13. output_file = codecs.open('outputtest.txt', 'w', encoding='utf-8')
  14. output_file.write(line)
  15. output_file.close()
  16.  
  17. འདུལ་//X བ་/E ག་/S བཞུགས་/S སོ/S །/S <utt>
  18. འདུལ་/X བ་/Y གཞི/E །/S <utt>
  19. བམ་/X པོ་/E ལྔ་/S བཅུ་/S ལྔ་/X པ/E །/S <utt>
  20. ཐུན་/X མོང་/E མ་/S ཡིན་/X པ་/E གང་/S ཞེ་/S ན/S །/S <utt>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement