There are many ways of solving this issue. As you can see from @shekaha's post, it is possible to use other libraries such as Pandas that will do the job for you. It appears that you are new to Python, so I suggest that you consider learning about how to do it yourself.
What follows is a very simple example of formatting. For a real application you will want to make things much more robust.
It is important to remember for your application that, when you print something, everything is ultimately converted into a string. Hence, if you want columns to "line up", you will need to make sure that the strings that represent each item in each column have the same length (including white spaces. Since your input has integers and strings, you will want to convert everything into a string first.
newData = [[str(v) for v in vs] for vs in displayStock]
Now, you will want to calculate the max length of each column. There are many ways of doing that. I'll do this in a couple of steps to make things simple:
lengths = [[len(v) for v in vs] for vs in newData]
maxLens = [max(lengths) for lengths in zip(*lengths)]
maxLens
will give you the maximum lengths of each column. You will have to generate the proper texts with the right length that you want to print in each line. Here is an example of how you can do that
printStrs = [ ' '.join([ f'{v:{maxLens[i]}}' for i, v in enumerate(vs) ]) for vs in newData]
toPrint = '\n'.join( printStrs )
The last variable toPrint
is something that you can use for printing the result.
Consider looking through the result and figure out how you will improve the results. For example, you may want to have different columns right- or left-justified. Try to figure out how you will do that.