Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding=utf-8
  3.  
  4. ignore_list = ('Search-Navigation','Tools-What links','Top-','Contents','Magyar')
  5. with open('AcronymsFile.csv','r') as inp:
  6. data = inp.read().split('\n')
  7.  
  8. with open('clean_AcronymsFile.csv','w') as out:
  9. out.write('acronym'+'\t'+'definition'+'\n')
  10.  
  11. for line in data:
  12. if not line.startswith(ignore_list):
  13. tmp = line.split('-')
  14. acronym = tmp[0].strip()
  15. definition = '-'.join([x.strip() for x in tmp[1:]])
  16.  
  17. out.write(acronym+'\t'+definition+'\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement