为什么spyder上运行这个代码提示语法错误,该怎么解决
importosimportreos.chdir("D:/workstation")fw=open("phy.txt","w")forhtmlinos.listdir("...
import os
import re
os.chdir("D:/workstation")
fw = open("phy.txt", "w")
for html in os.listdir("html/"):
html_file ="html/" + html
acc = html.replace(".html", "")
fr = open(html_file,"r") for line in fr.readlines():
if re.search("Molecular weight:", line):
aa_ num= re.search(r"Molecular weight: (\d+)", line).group(2)
print_out = acc + "\t" + aa_num+ "\n" fw.write(print_out)
fr.close()
fw.close() 展开
import re
os.chdir("D:/workstation")
fw = open("phy.txt", "w")
for html in os.listdir("html/"):
html_file ="html/" + html
acc = html.replace(".html", "")
fr = open(html_file,"r") for line in fr.readlines():
if re.search("Molecular weight:", line):
aa_ num= re.search(r"Molecular weight: (\d+)", line).group(2)
print_out = acc + "\t" + aa_num+ "\n" fw.write(print_out)
fr.close()
fw.close() 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询