Reading Log Files and Getting Avg In python [duplicate]
i am working on a project and am making a rock paper sc开发者_运维问答issors robot however i want the robot to learn with every single input it gets. My program logs all old inputs into a log.log file. It sorts old inputs into a number, either 1, 2 or 3. I am struggling to get my program to get an average of the file.
The log.log file looks something like this:
1
3
2
3
2
1
3
I need to somehow transfer that into an average which would be 2.14285714286.
Any help would be much appreciated.
I have tried reading the file into a list and then taking the average. Im not very good at understanding the log module wich is why i am having issues
精彩评论