【问题】
I'm trying to check whether column 3 of a tab-delimited file contains a certain word. If it does not, it should continue reading. If it does contain the word, it should check column 4. Depending on whether there is content in column 4, the output should be something found or something not found.
I'm not stuck on the second part of this, i.e. checking column 4. My output gives me"something found" when there is in fact no content there.
for line in f:
if line.strip()split("\t")[2] == "word":
print ("word")
if line.strip().split("\t")[3] is not None:
print ("something found")
else:
print("nothing found")
The file looks like this:
reference #1 reference #2 notword content ...(more columns)
reference #1 reference #2 word content ...
reference #1 r