Would this be the way to sort a list of stock information with sorted using stock symbols as the key to sort on?
new_translactions_info = sorted(transactions_info, key=lambda transactions_info: i.stock_symbol)
transactions_info = new_transactions_info. Also, for reference, here's the code I currently have: https://pastebin.com/Gw64H1ky. And here's my template: https://pastebin.com/macgJ9AE.
The reason I want to do this is so that I can compare adjacent items in a list, while being able to guarantee that adjacent items in the list have the same stock symbol and can add up stocks' numbers of shares for the current user's holdings of the same stock.
Anyway, thanks in advance for any help. If there's a good place I can go to read about it, like a page in the Python documentation, it'd be great if someone would point me there.