Ahoy all.
I am making my slow way across python,and this time better than I have previously.
Perhaps its the better material I'm refering to, or all the scripting I have tried has helped me in understand certain things which I wasn't able to before.
This is kind of game related,and kind of not. Its more of how would I go about doing x in python or any programming language type of question more than anything else.
I have Written a utility in python that reads a file,which contains settlement logs from core-exiles
a abbreviated output of which is as follows
Jun 15th 08:55 pm
» Dragon: Wesbec Delivery (192) to Magnia / Set Fee: 103697 CR
Jun 15th 06:47 pm
» Achilleos: Wesbec Delivery (102) to Daray / Set Fee: 4776 CR
Jun 15th 06:43 pm
» Achilleos: Wesbec Delivery (152) to Quettin / Set Fee: 6340 CR
Jun 15th 06:43 am
» Dragon: Wesbec Delivery (200) to Furia Station / Set Fee: 105039
Jun 14th 05:54 pm
» Korth: Wesbec Delivery (183) to Rosotika / Set Fee: 46576 CR
Jun 14th 05:54 pm
» Korth: Wesbec Delivery (180) to Sul-Rodet / Set Fee: 45812 CR
There's a reason why I have the log as that long,bare with me.
So far I have managed to make it take input of a filename,read lines in the file,determine which we want,discard which are not needed.
the lines beginning with the symble » are the ones we are interested in.
the word 1 or the second word as they'd say in python and other languages is the word in the lines we are interested in,along with the second last word.
I.E Dragon,and the numbers before CR
So far I have managed to get the first word and the second last from each line and have the utility get second last words percentage and print it out.
What I'd like to do is, have the code read each line,and give me the total of the percentages of all dragons hauls,korths and so on.
They won't be in order,as can be seen from the log above,I.E dragon appears once,then twice with another in between.
I'm thinking I could achieve something like this with dictionaries, any ideas? suggestions?
Thanks!
grryf
Follow me on twitter