python剔除文字檔案每行頭尾的空格字元
def trimLineSpace(finput, foutput):
fInputHandle = open ( fInput )
fOutputHandle = open (fOutput, 'w')
lines = fInputHandle.readlines()
for line in lines:
fOutputHandle.write(line.strip()+'\r\n')
fInputHandle.close()
fOutputHandle.close()
if __name__ == '__main__':
fInput = 'test.txt'
fOutput = 'output.txt'
trimLineSpace(fInput, fOutput)