一段脚本解读

一段脚本解读

with open("../xl-20160426/Makefile") as f:
    lines = f.readlines()

打开文件Makefile,赋值给lines

lines[
0] = "Q = "+str(q)+"\n" lines[1] = "M = "+str(m-1)+"\n" lines[2] = "N = "+str(n-m-2)+"\n" print("",lines[0],lines[1],lines[2]) with open("../xl-20160426/Makefile", "w") as f: f.writelines(lines) subprocess.run("cd ../xl-20160426; make", shell=True) subprocess.run("cp ../xl-20160426/xl .", shell=True)

 

posted on 2022-08-31 18:25  RicLiu  阅读(18)  评论(0编辑  收藏  举报