title: Python replacing certain columns
body: <p>input.txt is tab-delimited.</p>
  
  <p>I know a simple code to replace. </p>
  
  <pre><code>import fileinput
  for line in fileinput.FileInput("input.txt",inplace=1):
      line = line.replace("AA","0")
      print line,
  </code></pre>
  
  <p>However, I want to replace cells of only the 3rd column of input.txt (not the whole file input.txt), and I want to replace a cell by 0 if it is any one of AA or AAA or BB or BBB, replace a cell by 1 if it is not any one of them.</p>
  
  <p>Here, I am talking about "Match entire cell contents"</p>
  
  <p>By "Match entire cell contents" I mean that, it will be replaced only when a cell (such as (2,3)-element of input.txt) is exactly AA or AAA or BB or BBB. A cell such as "AAs" will not be replaced by anything.</p>
  
  <p>On the contrary if "Match entire cell contents" is not applied, then it will be replaced whenever a cell merely "contains" AA or AAA or BB or BBB. So a cell "AAhaha" will be replaced by "0haha"</p>
  
  <p>Anyhow, to repeat, I want to replace cells of only the 3rd column of input.txt (not the whole file input.txt), and I want to replace a cell by 0 if it is any one of AA or AAA or BB or BBB, replace a cell by 1 if it is not any one of them, in a "Match entire cell contents" way.</p>