import sys,os, fileinput
FileA = raw_input('Enter CSV file with lists of Files:') try: fp6 = open(FileA,'r') except IOError: sys.exit('Could not open file: %s' % FileA) while True: lines = fp6.readline().split(",") file11 = lines[0] file12 = lines[1] file3 = lines[2] #file11 = raw_input('Enter PR1 File name :') #fp1 = open(file11,'r') try: fp1 = open(file11, 'r') except IOError: sys.exit('Could not open file: %s' % file11) #file12 = raw_input('Enter PR3 File Name :') #fp2 = open(file12,'r') try: fp2 = open(file12, 'r') except IOError: sys.exit('Could not open file: %s' % file12) #file3 = raw_input('Enter PR2 OUTPUT File Name :') try: fp3 = open(file3, 'w') except IOError: sys.exit('Could not open file %s to Write' % file3) while True: try: line1 = fp1.readline().split(",") line2 = fp2.readline().split(",") #line1 = line1A.split(",") col1 = line1[0] col2 = line1[1] col3 = line1[2] col4 = line1[3] col5 = line1[20] col6 = line1[21] col7 = line1[22] #line2 = line1B.split(",") col8 = line2[1] col9 = line2[2] col10 = line2[3] col11 = line2[20] col12 = line2[21] col13 = line2[22] #def __FormulaPR2(): #claculation of PR2 as per formula #(A+B)/2 , ie. Mean of the two values col14 = (((float(col2)) + (float(col8))) / 2) col15 = (((float(col3)) + (float(col9))) / 2) col16 = (((float(col4)) + (float(col10))) / 2) col17 = (((float(col5)) + (float(col11))) / 2) col18 = (((float(col6)) + (float(col12))) / 2) col19 = (((float(col7)) + (float(col13))) / 2) print col1,col14,col15,col16,col17,col18,col19 str3 = '%s,%s,%s,%s,%s,%s,%s\n' % (col1,col14,col15,col16,col17,col18,col19) fp3.write(str3) On Fri, Aug 20, 2010 at 4:48 PM, Steven D'Aprano <st...@pearwood.info> wrote: > On Fri, 20 Aug 2010 06:27:01 pm nitin chandra wrote: >> Thank you, Alan and Steven. >> >> Now i am facing some thing 'different' >> >> This is even when i have not done a carriage return to create line >> "66". This is after i have done >> fp1.close() >> fp2.close() >> fp3.close() >> ****************************************************** >> >> File "mer5Pr2.py", line 66 >> >> ^ >> IndentationError: unexpected unindent > > > Without seeing the actual code, it's hard to say. But you need to learn > to read the error message: it says you have unexpectedly unindented > (outdented). My guess is you've done something like this: > > if something: > line indented with 4 spaces > line indented with 2 spaces > > > You need to indent consistently. Set your editor to always use 4 spaces > for indents. If you can't do that, then get a better editor, or use a > single tab instead of four spaces. > > Some people will say don't use tabs. I say phooey to them. It's better > to use tabs than to have inconsistent indentation. > > > > -- > Steven D'Aprano > _______________________________________________ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor