title: How to avoid lines that contain both string and numbers before splitting them?
body: <p>I use python 3, and I read files that strart with few lines that contain text and number together, and from a certain line it's only columns of numbers, that originally they are also read as str after splitting, that I later convert them to float.</p>
  
  <p>the data look like this . I also add the link to the sample of the numbers </p>
  
  <p><a href="https://gist.github.com/Farzadtb/b0457223a26704093524e55d9b46b1a8" rel="nofollow noreferrer">https://gist.github.com/Farzadtb/b0457223a26704093524e55d9b46b1a8</a></p>
  
  <p><a href="https://i.stack.imgur.com/MbqXc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbqXc.png" alt="enter image description here"></a></p>
  
  <p>So the problem is that for reading I have two conditions ( actually I wish to increase these conditions ) using try: except . but this only works for dividing the splitting method. but before I start splitting ,I need to remove the first lines that contain text. what I know is that I should use </p>
  
  <p>except ValueError</p>
  
  <p>but this does not really work ! </p>
  
  <pre><code>f = io.open(file, mode="r", encoding="utf-8")
      #f=open(file,"r")
      lines=f.readlines()
  
      x=[]
      y=[]
      z=[]    
  
      for i in lines:
  
          try:
              a=[i.strip('\n')]
              a1=[float(n) for n in a[0].split(',')]
              atot.append(a1)
              x.append(a1[3])
              y.append(a1[2])
              z.append(a1[1])
  
          except :
               a=[i.split('\n')]
               a1=[float(n) for n in a[0].split()]
               x.append(a1[3])
               y.append(a1[2])
               z.append(a1[1])
  </code></pre>
  
  <p>the problem is that since the first lines could also start with numbers, it's possible that the first parameter is split and added to "x" and "y" but I get error for z</p>
  
  <pre><code>x=[float(i) for i in x]
  y=[float(i) for i in y]
  z=[float(i) for i in z]
  </code></pre>
  
  <p>One idea that comes to my mind is to check if the line could be converted to float with no errors , and then proceed with splitting ,but I don't know how to do it</p>