因此,当我单独编写这段代码时,它可以正常工作,但是当我将它们组合在一起时,它会给我 typeError。为什么会这样?当我单独编写它们时我不明白它工作正常。提前致谢 :)
def printOutput(start, end, makeList):
if start == end == None:
return
else:
print start, end
with open('OUT'+ID+'.txt','w') as outputFile:#file for result output
for inRange in makeList[(start-1):(end-1)]:
outputFile.write(inRange)
with open(outputFile) as file:
text = outputFile.read()
with open('F'+ID+'.txt', 'w') as file:
file.write(textwrap.fill(text, width=6))