Are there any potential differences between Python versions using open. My script accepts a file, performs some calculations and outputs these calculations.
On my machine (running 2.7.1) the output is correct. On the other machine (running 2.4.6) my output is all 0.00. Nearest I can tell, my input file isn't being opened. Is there a difference between open() between these versions?
Here's what my current open scheme looks like:
infile = open(filename, 'r')
An additional question: the next(infile) method does not skip the first line for me anymore in 2.6.4. Does replacing next(infile) with lines = infile.readlines()[1:0] affect performance?
EDIT: CRAP THE VERSION OF THE OTHER MACHINE IS 2.4.6. Not sure how I messed that up. The original post reflects my screwup, sorry guys.
Edit2: Below is my code for reading from the file:
for lines in infile:
# do stuff with lines
infile.close()
I'm guessing there's something here that may be different between 2.4.6 and 2.7.1
FINAL EDIT:
Solved my own problem guys. next(infile) is not compatible with 2.4.6 for some strange reason. I replaced it and ran my script correctly.
Thanks for your help!
open(..)function, you should post the details of your calculation code (the full list of release notes is here ). For example this answer mentions thatround(..)was fixed in 2.7 .%timeit thing_to_testin ipython...