Advertisement
Guest User

TypeError: 'in <string>' requires string as left operand, no

a guest
Apr 8th, 2020
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. nodelist = ["1.1.1.1", "2.2.2.2"]
  2.  
  3. def checkactivenode(file_name, ip_to_search):
  4.   with open(file_name, 'r') as read_obj:
  5.     for list in read_obj:
  6.       if ip_to_search in list:
  7.         return True
  8.   return False
  9.  
  10. after executing: checkactivenode(filename, nodelist)
  11.  
  12. Error:
  13. Traceback (most recent call last):
  14.   File "main.py", line 42, in <module>
  15.     checkactivenode(pwlcfullpath, nodelist)
  16.   File "main.py", line 33, in checkactivenode
  17.     if ip_to_search in list:
  18. TypeError: 'in <string>' requires string as left operand, not list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement