Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # coding=utf-8
- ignore_list = ('Search-Navigation','Tools-What links','Top-','Contents','Magyar')
- with open('AcronymsFile.csv','r') as inp:
- data = inp.read().split('\n')
- with open('clean_AcronymsFile.csv','w') as out:
- out.write('acronym'+'\t'+'definition'+'\n')
- for line in data:
- if not line.startswith(ignore_list):
- tmp = line.split('-')
- acronym = tmp[0].strip()
- definition = '-'.join([x.strip() for x in tmp[1:]])
- out.write(acronym+'\t'+definition+'\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement