python check unique id in file and count
<p>In the following <code>file.txt</code> for each ID shown I need to check how many number of times the currency is found for an ID. How can i do this?</p>

<p>file.txt</p>

<pre><code>  ID101\tbill is $200
  ID101\tyour bill
  ID101\t $200 again
  ID101\t$100 is the generated amount
  ID101\t$50 is your amount
  ID101\t$74 is the amount
  ID102\tNo bill
  ID102\tbill is $75
  ID103\t$65 is your bill
  ID103\tno bill
</code></pre>

<p>code</p>

<pre><code>f=open("file.txt")
arr=[]
count = 0
for l in f:     
   col = 0
   for i in l.split("\t"):
      if col == 0:
         if i not in arr: //tocheck whether it is a new id or not
            arr.append(i)
         if col == 1:
            if "$" in i:
              count += 1
      col += 1
</code></pre>

<p>How to check the count for each ID?</p>
