<div dir="ltr"><div><div><div>Here I have a code which basically reads a csv file, tries to compare the last 2 items in each line of the file. <br><br>f = open(r"Z:\modules\Feature_Vectors_300_Pclass.arff")<br>for l in f:<br>
sp = l.split(",")<br> if len(sp) != 11:<br> print >> of, l,<br> <br> else:<br> #print sp[9], sp[10]<br> if sp[9] == sp[10]:<br> print " Same class" <br>
else :<br> print "Different class"<br> <br>f.close()<br><br></div>For me I think the programme is logically correct, but its giving me results which are strange. <br></div>It is Printing " Different Class" even when sp[9] is equal to sp[10] and "Same class" when sp[9] is not equal to sp[10]. and sp[9] and sp[10] are simple integers like 3, 3, 4 ,4. <br>
<br></div>I have a little understanding why the programme is behaving like this ?<br></div>