Python - Formatting a print to align a specific column
<p>I am trying to format a print statement to align a specific column. </p>

<p>Currently my output is: </p>

<pre><code>0 - Rusty Bucket (40L bucket - quite rusty) = $0.00
1 - Golf Cart (Tesla powered 250 turbo) = $195.00*
2 - Thermomix (TM-31) = $25.50*
3 - AeroPress (Great coffee maker) = $5.00
4 - Guitar (JTV-59) = $12.95
</code></pre>

<p>The output I am looking for is:</p>

<pre><code>0 - Rusty Bucket (40L bucket - quite rusty)    = $0.00
1 - Golf Cart (Tesla powered 250 turbo)        = $195.00*
2 - Thermomix (TM-31)                          = $25.50*
3 - AeroPress (Great coffee maker)             = $5.00
4 - Guitar (JTV-59)                            = $12.95
</code></pre>

<p>Here is the code I am currently using for the print:</p>

<pre><code>def list_items():
    count = 0
    print("All items on file (* indicates item is currently out):")
    for splitline in all_lines:
        in_out = splitline[3]
        dollar_sign = "= $"
        daily_price = "{0:.2f}".format(float(splitline[2]))
        if in_out == "out":
            in_out = str("*")
        else:
            in_out = str("")
        print(count, "- {} ({}) {}{}{}".format(splitline[0], splitline[1], dollar_sign, daily_price, in_out))
        count += 1
</code></pre>

<p>I have tried using formatting such as: </p>

<pre><code>print(count, "- {:&gt;5} ({:&gt;5}) {:&gt;5}{}{}".format(splitline[0], splitline[1], dollar_sign, daily_price, in_out))
</code></pre>

<p>but have never been able to get just the one column to align. Any help or suggestions would be greatly appreciated! I am also using python 3.x</p>

<p>To note I am using tuples to contain all the information, with <code>all_lines</code> being the master list, as it were. The information is being read from a csv originally. Apologies for the horrible naming conventions, trying to work on functionality first. </p>

<p>Sorry if this has been answered elsewhere; I have tried looking. </p>

<p>EDIT: Here is the code im using for my all_lines</p>

<pre><code>import csv
open_file = open('items.csv', 'r+')
all_lines = []
for line in open_file:
    splitline = line.strip().split(',')
    all_lines.append((splitline[0], splitline[1], splitline[2], splitline[3]))
</code></pre>

<p>And here is the csv file information:</p>

<pre><code>Rusty Bucket,40L bucket - quite rusty,0.0,in
Golf Cart,Tesla powered 250 turbo,195.0,out
Thermomix,TM-31,25.5,out
AeroPress,Great coffee maker,5.0,in
Guitar,JTV-59,12.95,in
</code></pre>