title: Convert commas to dots in txt with python that also contains scientific number formatting
body: <p>I have a text file ( huge ) with all numbers separated with a combination of spaces and tabs between them and with comma for decimal and after decimal separation, while the first column is scientific formatted and the next ones are numbers but with commas. I just put the first row here  as numbers :</p>
  
  <blockquote>
    <p>0,0000000E00     -2,7599284          -1,3676726          -1,7231264          -1,0558825          -1,8871096          -3,0763804          -3,2206187          -3,2308111          -2,3147060          -3,9572818          -4,0232415          -4,2180738      </p>
  </blockquote>
  
  <p>the file is so huge that a notepad++ can't process it to convert the "," to "." </p>
  
  <p>So what I do is :</p>
  
  <pre><code>with open(file) as fp:
      line = fp.readline()
      cnt = 1
      while line:
          digits=re.findall(r'([\d.:]+)', line)
          s=line
          s = s.replace('.','').replace(',','.')
          number = float(s)
          cnt += 1 
  </code></pre>
  
  <p>I tried even to use digits, but that causes to divide the first column in two numbers :</p>
  
  <p><a href="https://i.stack.imgur.com/IfpWP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IfpWP.png" alt="output-digits"></a></p>
  
  <p>and eventually the error I get when using .replace command. what I would have prefered was to convert the commas to dots regardless of disturbing formats like scientific. I appreciate your help</p>
  
  <blockquote>
    <p>ValueError: could not convert string to float: ' 00000000E00<br>
    \t-29513521      \t-17002219      \t-22375536      \t-14994097<br>
    \t-24163610      \t-34076621      \t-31233623      \t-32341597<br>
    \t-24724552      \t-42434935      \t-43454237      \t-44885144<br>
    \n'</p>
  </blockquote>
  
  <p>I also put <strong><em>how the input looks like</em></strong> in txt <strong><em>and how I need it in output</em></strong> ( in csv format ) </p>
  
  <p>input seems like this :</p>
  
  <p><strong>first line :</strong> </p>
  
  <p>between 1st and 2nd column : 3 spaces + 1 Tab</p>
  
  <p>between rest of columns : 6 spaces + 1 Tab</p>
  
  <p><strong>second line and on :</strong> </p>
  
  <p>between 1st and 2nd column : 2 spaces + 1 Tab</p>
  
  <p>between rest of columns : 6 spaces + 1 Tab</p>
  
  <p>this is a screen shot of the <strong><em>txt input file</em></strong> :
  <strong><em>Attention :</em></strong> there is one space in the beginning of each line</p>
  
  <p><a href="https://i.stack.imgur.com/6goyo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6goyo.png" alt="input-txt"></a></p>
  
  <p>and what I want as <strong><em>output is csv file</em></strong> with separated columns with " ; "</p>
  
  <p><a href="https://i.stack.imgur.com/5YuFA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5YuFA.png" alt="enter image description here"></a></p>