how to enumerate a specific column of a file
<p>I was trying to enumerate the second column of the input file but my code gives the below error. How can I fix my code to get the below output file? </p>

<p>Error:</p>

<blockquote>
  <p>Traceback (most recent call last):   File "./rename_atoms.py", line 7,
  in 
      print(item+index) TypeError: cannot concatenate 'str' and 'int' objects</p>
</blockquote>

<p>My code:</p>

<pre><code>#!/usr/bin/python

with open ('input.gro', 'r') as f:
    for line in f:
        column=line.split()
        for index, item in enumerate(column[1]):
            print(item+index)
</code></pre>

<p>Input file:</p>

<pre><code>GRoups of Organic Molecules in ACtion for Science
   18
    1LIG      O    1   1.665   1.740   8.646
    1LIG      O    2   0.877   2.044   7.947
    1LIG      S    3   1.469   1.778   8.501
    1LIG      S    4   1.340   1.695   8.487
    1LIG      S    5   1.231   1.770   8.412
    1LIG      N    6   1.282   1.801   8.268
    1LIG      C    7   1.553   1.679   8.585
    1LIG      C    8   1.523   1.805   8.360
    1LIG      C    9   1.313   1.647   8.630
    1LIG      H   10   1.418   1.875   8.271
    1LIG      H   11   1.454   1.624   8.688
    1LIG      H   12   1.100   1.691   8.403
    1LIG      H   13   1.453   1.912   8.577
    1LIG      H   14   1.174   1.869   8.184
    1LIG      H   15   0.992   1.777   8.339
    1LIG      H   16   1.037   1.853   8.217
    1LIG      H   17   1.206   1.941   8.068
    1LIG      H   18   0.939   1.914   8.137
      0.00000   0.00000   0.00000
</code></pre>

<p>Desired output file:</p>

<pre><code>GRoups of Organic Molecules in ACtion for Science
   18
    1LIG      O1    1   1.665   1.740   8.646
    1LIG      O2    2   0.877   2.044   7.947
    1LIG      S1    3   1.469   1.778   8.501
    1LIG      S2    4   1.340   1.695   8.487
    1LIG      S3    5   1.231   1.770   8.412
    1LIG      N1    6   1.282   1.801   8.268
    1LIG      C1    7   1.553   1.679   8.585
    1LIG      C2    8   1.523   1.805   8.360
    1LIG      C3    9   1.313   1.647   8.630
    1LIG      H1   10   1.418   1.875   8.271
    1LIG      H2   11   1.454   1.624   8.688
    1LIG      H3   12   1.100   1.691   8.403
    1LIG      H4   13   1.453   1.912   8.577
    1LIG      H5   14   1.174   1.869   8.184
    1LIG      H6   15   0.992   1.777   8.339
    1LIG      H7   16   1.037   1.853   8.217
    1LIG      H8   17   1.206   1.941   8.068
    1LIG      H9   18   0.939   1.914   8.137
      0.00000   0.00000   0.00000
</code></pre>