我正在处理一个无效的脚本。
首先我转录错误:
File "/home/path", line nº, in out_to_mop_let #~this is the function
for lindex in range(lstart+ 4,lfinish):
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
脚本是下面的脚本,我在这个问题上放了**符号:
def out_to_mop_let (namefilein, namefileout, keywords=""):
print namefilein
filein=open(namefilein, "r")
fileout=open(namefileout, "w")
lines = filein.readlines()
filein.close()
lstart = None
lfinish = None
for lindex in range(0,len(lines)):
if lindex-4>lstart and lines[lindex]=='\n' and lfinish==None and lstart!=None:
lfinish=lindex+1
if "CURRENT VALUE OF HEAT OF FORMATION" in lines[lindex]:
lstart=lindex
print lstart
print lfinish
fileout.write(keywords + "\n\n\n")
**for lindex in range(lstart+ 4,lfinish):
fileout.write(lines[lindex])**
fileout.close()
filein.close()
有什么不对吗?
答案 0 :(得分:0)
此脚本似乎存在一些潜在问题。