I'm new to python and my problem seems to be so stupid I can't even find an answer when I google it...
I'm writing a program that uses data on different planets and their satellites, makes some calculations to get the mass of the planets, and is then supposed to present the calculated data in a table.
The table is my problem. I'm using lists, but when I print the table I created it looks terrible.
Here is my code so far:
table = [["Typ av data", "Jupiter", "Saturnus", "Solen"],
["Planetmassa", jupiter_massa, saturnus_massa, solen_massa],
["Standardavvikelse", jupiter_standardavvikelse, saturnus_standardavvikelse, solen_standardavvikelse]]
for row in table:
print(row)
(It's in swedish but that shouldn't matter. The words with "" are just words/strings, and the rest are lists containing the data.)
This is what it looks like when I print it:
['Typ av data', 'Jupiter', 'Saturnus', 'Solen']
['Planetmassa', 4.110628390867864e+39, 1.2347845577268216e+39, 4.319543783963521e+42]
['Standardavvikelse', 2.3357256803779513e+37, 8.050789009367835e+36, 1.9328559536580606e+40]
If possible I want to get rid of the brackets and the '', but most importantly - I want it to be displayed as a proper table with a fixed column width. Like I said I have googled but can't find a single answer (maybe I'm just stupid). I have also tried to install modules like prettytable and texttable, but it doesn't seem to work on my computer so I need to work with what already exists.
So - how do I fix the column width?
I hope this makes sense and that someone can help me cause I'm going mad. If you need any more information please let me know.