因此,我有一个脚本,我试图运行,但它不工作,我得到了“语法错误接近意外的标记`('”错误消息。脚本如下所示
i=open("Top_200_Cluster_NEW.sdf","r")
o=open("List_Cluster_Compound_J.txt","w")
for line in i.readlines():
if line.startswith('> <Molecule Name>'):
o.write(line)
elif line.startswith('> <Cluster No (0.8)>'):
o.write(line)
elif line.startswith('> <rfscore_v3>'):
o.write(line)
i.close()
o.close()
脚本名称类似于cluster-name.py
,我真的不知道我错在哪里,任何帮助都是令人惊奇的。 谢啦!
提供线路也是问题来自哪里,这将是一个帮助。 使用with
格式会更有效。
with open('file.txt','r') as fs:
fs.read()