1
鉴于这些数据跳绳线间歇性地在Python
Probes FOO BAR
Organ BM LV
Genes Gene1 Gene2
1452463_x_at 306.564 185.705
1439374_x_at 393.742 330.495
1426392_a_at 269.850 209.931
我想跳过打印头两行与器官和基因开始。 我试图做的是:
with open('my_data.txt','r') as tsvfile
tabreader = csv.reader(tsvfile,delimiter = '\t')
for row in tabreader:
if ["Genes","Organ"] in row:
continue
print row
但为什么失败?
最终所需的输出是这样的:
Probes FOO BAR
1452463_x_at 306.564 185.705
1439374_x_at 393.742 330.495
1426392_a_at 269.850 209.931
在Python,它更容易只是negaate用'not'函数的声明。例如,你可能会考虑使用表达式:'如果行[0]不是(“基因”,“器官”):打印row' – ssm