title: python/flask opening a text file in flask
body: <p>with open(url_for('static', filename='bmidata.txt') as f:</p>
  
  <p>the above line causes a syntax error (marked at the 'as'). The code is part of the following:</p>
  
  <pre><code>@app.route('/display')
  def display():
  page_info = {
      'title':'Assignment Flask',
      'heading': 'Python Flask Assignment'
  }
  filedata = []
  with open(url_for('static', filename='bmidata.txt') as f:
      for line in f:
          str = line
          dataarray = str.split(',')
          it =iter(dataarray)
          name = it.next()
          height = it.next()
          weight = it.next()
          newPerson = Person(name, height,weight)
          filedata.append(newPerson)
  
  return render_template('display.html', info = page_info, fileinfo = filedata)
  </code></pre>
  
  <p>Any help appreciated</p>