Advertisement
Guest User

Untitled

a guest
May 27th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. # init opens up the files and does a few checks on them
  2. def init(sample, common):
  3.  
  4. try:
  5. with(common, 'r') as f:
  6. common_words = f.read()
  7. common_words = list(common_words)
  8. f.close()
  9. # convert list to lowercase
  10. common_words = [item.lower() for item in common_words]
  11. temp = []
  12. for word in common_words:
  13. word = word.replace('\n', '')
  14. temp += [word]
  15. common_words = temp
  16. except OSError as error:
  17. print('Cannot open {0:s}'.format(filename))
  18. raise error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement