Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

Why am I getting this error in the very basic Python script? What does the error mean?

Error:

Traceback (most recent call last):   File "cab.py", line 16, in <module>     if cab in line: TypeError: 'in <string>' requires string as left operand, not int 

Script:

import re import sys  #loco = sys.argv[1] cab = 6176 fileZ = open('cabs.txt') fileZ = list(set(fileZ))  for line in fileZ:      if cab in line:          IPaddr = (line.strip().split())         print(IPaddr[4])