title: Syntax Error invalid syntax for def Data(path)
body: <p>Here is the line of code where I am getting an error</p>
  
  <pre><code>def Data('C:/Users/username/Desktop/d.txt'):
      fp = open('C:/Users/username/Desktop/d.txt')
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>File "read.py", line 17
      def DataExtract('C:/Users/username/Desktop/d.txt'):
                                                      ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Not sure what the problem is and what is causing the invalid syntax</p>
  
  <p>Thank you!</p>
  
  <p>Here is the code I am working on:</p>
  
  <pre><code>def DataExtract('C:/Users/username/Desktop/d.txt'):
  fp = open('C:/Users/username/Desktop/d.txt')
  data = {}
  line = fp.read().split("\n")[2:7:5]:
  while line:
      name, _, cont = line.partition(":")
      keys, _, values = cont.partition("=")
      keys = keys.split(",")
      values = values.split(",")
      temp_d = {}
      for i in range(len(keys)):
          key = key[i].strip()
          val = values[i].strip()
          temp_d[key] = float(val)
      data[name] = temp_d
      line = fp.readline()
  fp.close()
  </code></pre>
  
  <p>return data</p>
  
  <pre><code>x = DataExtract('C:/Users/username/Desktop/d.txt')
  mul_p = x['d1']['p'] * x['d2']['p']
  print(mul_p)
  </code></pre>