print a list of dictionaries in table form
<p>assume I have this list as global list </p>

<pre><code> dataset =[{'Major': 'Biology', 'GPA': '2.4', 'Name': 'Edward'},
           {'Major': 'Physics', 'GPA': '2.9', 'Name':'Emily'},  
           {'Major':'Mathematics', 'GPA': '3.5', 'Name': 'Sarah'}]
</code></pre>

<p>and a want a function print() to print it as </p>

<pre><code> name     major        GPA 
 =============================== 
 edward   Biology      2.4 
 Emily    physics      2.9 
 sarah    mathematics  3.5
</code></pre>

<pre><code>for dicts in dataset:
    print(dicts.get('Name')),
    print(dicts.get('Major')),
    print(dicts.get('GPA')),
</code></pre>

<p>Example </p>

<pre><code>&gt;&gt;&gt; dataset =[{'Major': 'Biology', 'GPA': '2.4', 'Name': 'Edward'}, {'Major': 'Physics', 'GPA': '2.9', 'Name': 'Emily'}, {'Major': 'Mathematics', 'GPA': '3.5', 'Name': 'Sarah'}]
&gt;&gt;&gt; 
&gt;&gt;&gt; for dicts in dataset:
...         print(dicts.get('Name')),
...         print(dicts.get('Major')),
...         print(dicts.get('GPA')),
... 
Edward Biology 2.4 Emily Physics 2.9 Sarah Mathematics 3.5
</code></pre>

python