Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. >>> magicwords = ["tragedy", "comedy"]
  3.  
  4. >>> fileObj = codecs.open("C:\\avignontext\\avignon.txt", "r", "utf-8")
  5. >>> line = fileObj.readline()
  6. >>> fileObj = codecs.open("C:\\avignontext\\avignon.txt", "r", "utf-8")
  7. >>> line = fileObj.readline()
  8.  
  9. >>> for word in magicwords:
  10. type(word) is str
  11.  
  12.  
  13. True
  14. True
  15. >>> for word in magicwords:
  16. if word in line:
  17. print "found"
  18.  
  19.  
  20.  
  21. Traceback (most recent call last):
  22. File "<pyshell#30>", line 2, in <module>
  23. if word in line:
  24. TypeError: 'in <string>' requires string as left operand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement