I am a beginner to Python so bear with me. Basically I am searching a particular table cell for the forward slash character. If the cell contains that character, I want to delete the entire row.
counter = 0
for row in table:
if row[7].find("/") != -1:
del table[counter]
continue
counter+=1
The code above never detects the forward slash but finds any other character I substitute for forward slash. Any help would be much appreciated.
"/" in row[7], it's much more Pythonic. You should really avoid deleting elements of the list you're iterating over as that causes undefined behaviour. You can also usefor counter, row in enumerate(table):and avoid having to keep your own counter variable.enumerate()can't help in this case.