title: Best way to dynamically show all keys for arrays in Python
body: <p>I'm a newbie at Python and I'd like to know if there is a better solution for dynamically showing all the attributes under an object(keyword, woe_code, timestamp).</p>
  
  <p>ORIGINAL CODE:</p>
  
  <pre><code>trends = models.Trends.query.all() 
  for t in trends:
     print t.keyword, t.woe_id, t.woe_code, t.timestamp  #I know this is wrong, hardcoding the attributes.
  </code></pre>
  
  <p>NEW CODE:</p>
  
  <pre><code>trends = models.Trends.query.all() 
  for t in trends:
      for k, v in vars(t).iteritems():
           print k+"KEY"
                       print v+"Value"
  </code></pre>