Advertisement
Guest User

Untitled

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