<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 1:41 PM, upendra kumar Devisetty <span dir="ltr"><<a href="mailto:upendrakumar.devisetty@googlemail.com" target="_blank">upendrakumar.devisetty@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a very basic question in python. I want to go through each line of the a csv file and compare to see if the first field of line 1 is same as first field of next line and so on. If it finds a match then i would like to put that field in an object1 else put that field in a different object2. Finally i would like to count how many of the fields in object1 vs object2. Can this be done in python? Here is a small example.<br>

<br>
BRM_1   679 1929<br>
BRM_1   203 567<br>
BRM_2   367 1308<br>
BRM_3   435 509<br>
As you can see field1 of line1 is same as field2 of line2 and so that field BRM_1 should be place in object1 and BRM_2 and BRM_3 should be placed in object2. So the final numbers of object1 is 1 and object2 is 2.<br>
<br></blockquote><div><br></div><div>You should study the csv module.   <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks in advance..<br>
<span class="HOEnZb"><font color="#888888"><br>
Upendra<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>