How to make sure output is same length?
<p>I want to know is there a way in python to make sure that the output is the same length , by adding white space or something like that.</p>

<pre><code>78364721 apple 3 3 9
35619833 orange 4 2 8
46389121 chicken 1 10 10
total price of order Â£ 27
</code></pre>

<p>I want :</p>

<pre><code>78364721  apple     3 3 9
35619833  orange    4 2 8
46389121  chicken 1 10 10
total price of order Â£ 27
</code></pre>

<p>Current Code :</p>

<pre><code>All_list=[items,product_list,items2,indprice_list,newprice_list]
for a in zip(*All_list):
    print(*a)

print("total price of order","Â£",total_price)


46389121   chicken     2 10 20
total price of order Â£ 40
46389121   chicken     2 10 20
total price of order Â£ 40
</code></pre>

<p>Here's a simple example using <a href="https://docs.python.org/3/library/string.html#format-string-syntax" rel="nofollow">format string syntax</a>:</p>

<pre><code># -*- coding: utf-8 -*-
dataframe = [
    [78364721, "apple", 3, 3, 9],
    [35619833, "orange", 4, 2, 8],
    [46389121, "chicken", 1, 10, 10]
]

for row in dataframe:
    print('{:8d}  {:10s}{:3d}{:3d}{:3d}'.format(
        row[0], row[1], row[2], row[3], row[4]))

print('total price of order \u00a3 {0}'.format(
    sum([row[4] for row in dataframe])))
</code></pre>

<p>If you want anything fancier than this I'd recommend you start using <a href="http://pandas.pydata.org/" rel="nofollow">pandas</a></p>

python python-3.x