last line chopped from input file
lavigne.eric at gmail.com
Sun Aug 21 07:53:42 CEST 2005
Here is a shell command (MS-DOS):
debug\curve-fit <input.txt >output.txt
And here is a Python script that *should* do the same thing (and almost
inputfilename = 'input.txt'
outputfilename = 'output.txt'
inputfile = open(inputfilename,'r')
outputfile = open(outputfilename,'w')
inputstream,outputstream = os.popen2("debug\\curve-fit")
In the shell command, my curve-fit program processes the entire input
file. In the Python script, my curve-fit program processes all except
for the last line. Adding an extra newline to the end of my input file
fixes this problem. What did I do wrong that led to this small
On a side note, I am very new to Python so I would appreciate any
comments on style, or suggestions for simpler ways to write something
like this (seems overkill for matching one line of shell), or more
portable ways to write it (requires '\\' on windows but '/' on linux).
More information about the Python-list