title: In Python, I have a Value Error in my line with .split(), returns 1 expected 2. Adding white space doesn't help. Issue with data.txt?
body: <p>Apologies if that title was vague. First I'd like to say that I have read through every forum I can find on the Value Error in python, I've implemented them but my program still can not get past line 22. There is more explanation at the bottom but first I'll give you the "DL" haha. </p>
  
  <p>I am writing a program that reads a data.txt file and displays the output. Here is the goal of the project </p>
  
  <blockquote>
    <p>Your output should look like:
    Reading vertices for a polygon with 5 vertices... Vertex 1 has coordinates at (1.70, 4.90) Vertex 2 has coordinates at (6.10, 6.20)
    
    Vertex 5 has coordinates at (1.50, 1.40)</p>
    
    <hr>
    
    <p>Reading vertices for a rectangle having, (of course), 4 vertices... Vertex 1 has coordinates at (7.00, 5.00)
    ...
    Your program only needs to echo check the data; there is no requirement during this lab to construct polygon objects, rectangle objects, to do transformations, to undo transformations, or to find and print perimeter.</p>
  </blockquote>
  
  <p>The error from my command line is:</p>
  
  <pre><code>Reading vertices for polygon with 5 vertices...
  Vertex 1 has coordinates at (1.7, 4)
  Vertex 2 has coordinates at (.9, 6.1)
  Vertex 3 has coordinates at (6.2, 7.0)
  Vertex 4 has coordinates at (2.8, 4.8)
  Vertex 5 has coordinates at (0.1, 1.)
  Reading vertices for polygon with 1 vertices...
  Traceback (most recent call last):
  File "Read.py", line 22, in &lt;module&gt;
    x, y = file.read(8).split( )
    ValueError: too many values to unpack (expected 2)
  </code></pre>
  
  <p>The code I have written is:</p>
  
  <pre><code>file = open("data.txt")
  
  line = file.read(1).strip()
  
  while line != 'Q':
  
      numVertices = file.read(3).strip()
      numVertices = int(numVertices)
  
  if numVertices != 4:
      print("Reading vertices for polygon with " + 
  str(numVertices) + " vertices...") 
  
  else:
      print("Reading vertices for rectangle having " + 
  str(numVertices) + " vertices...")
  
  for i in range(int(numVertices)):
  
      x, y = file.read(8).split( )
      print("Vertex " + str(i + 1) + " has coordinates at (" + x + ", " + y + ")")
  
  line = file.read(1).strip()
  
  file.close()
  </code></pre>
  
  <p>And the data.txt file contains:</p>
  
  <pre><code>P  5
  1.7   4.9
  6.1  6.2
  7.0  2.8
  4.8  0.1
  1.5  1.4
  R  4
  7.0  5.0
  1.0  5.0
  1.0  3.0
  7.0  3.0
  P  4
  4.1  5.4
  6.9  2.5
  2.9  0.8
  0.9   2.5
  P  3
  1.2  4.7
  6.5  4.2
  4.0  1.7
  Q
  </code></pre>
  
  <p><strong>In line 22 I have tried adding to the .split(), I have added (" "), (", ") none of which have succeeded. I have tried to change the variables from int to float, but then I can't concatenate a string. So I am at a loss, would someone mind helping me find out what the issue is here? Thank you so much!</strong></p>