I have created code in Python 2.7 which saves sales data for various products into a text file using the write() method. My limited Python skills have hit the wall with the next step - I need code which can read this data from the text file and then calculate and display the mean average number of sales of each item. The data is stored in the text file like the data shown below (but I am able to format it differently if that would help).

Product A,30

Product B,26

Product C,4

Product A,40

Product B,18

Product A,31

Product B,13

Product C,3

After far too long Googling around this to no avail, any pointers on the best way to manage this would be greatly appreciated. Thanks in advance.