Script for replacing digits
<p>I have a file that has content as below</p>

<pre><code>a      b     c    123.67989

aa   bb  cc   56789.38475

b    c   a    56789.3456

bb   cc  aa   0.12409124

c    a   b    0.0123123
</code></pre>

<p>I am trying to remove digits after the <code>.</code> in the each line. Is there is a way to do this using regular expressions in Python?
Code I wrote
f1 = open('filename.txt','r')</p>

<p>for line in f1:</p>

<pre><code>    words = line.split()
    print(words[3])
</code></pre>

<p>I am trying retrieve last row information and I keep getting error list indices out of range</p>

<p>I didn't use regular expressions but maybe this helps:</p>

<pre><code>text = "a      b     c    123.67989 \n" \
"aa   bb  cc   56789.38475 \n" \
"b    c   a    56789.3456 \n" \
"bb   cc  aa   0.12409124 \n" \
"c    a   b    0.0123123"

lines = text.splitlines()

for line in lines:
   line_without_digits = line.split('.')[0]
   print(line_without_digits)
</code></pre>

<p><strong>EDIT</strong></p>

<p>Example with first digit after ".":</p>

<pre><code>text = "a      b     c    123.67989 \n" \
"aa   bb  cc   56789.38475 \n" \
"b    c   a    56789.3456 \n" \
"bb   cc  aa   0.12409124 \n" \
"c    a   b    0.0123123"

lines = text.splitlines()

for line in lines:
    line_split = line.split('.')
    line_without_digits = line_split[0] + "." + line_split[1][0]
    print(line_without_digits)
</code></pre>

python python-3.x