#!/usr/bin/env pythoninputfile = "GCF_000001735.4_TAIR10.1_genomic.gtf"outputfile = "yangjincheng.txt"output = open(outputfile,"w")line_count = 1for line in open(inputfile): output.write(str(line_count) + "\t" + str("gene_id" in line) + "\n") ###最紧张的是 A in line 这个运算符,具有判定功能 line_count += 1output.close()得到的结果如图2所示:第一列是行名,第二列是判定结果。因此我们就必要把第二列中表现是True的行筛选出来;