I'm trying to pass a tuple after an if statement in a for loop. I'm not sure what I'm doing wrong.
procs = ((1432, 'var', 'var2', procname),(1556, 'var4', 'var5', othername),)
def killprocs(procname):
print "searching for %s" % procname
for i in procs:
if procname in i[3]:
print "proc %s matches." % i
else:
pass
I get:
Traceback (most recent call last):
File "processkiller.py", line 59, in <module>
killprocs(args.procname)
File "processkiller.py", line 24, in killprocs
print "proc %s matches." % i
TypeError: not all arguments converted during string formatting