Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import re
  2. hitre = re.compile(r"(?P<critical>Critical!\s|.*)Your\s(?P<attack>.*)\shits\s(the)?\s(?P<monster>.*?)(\sfrom\sthe)?(?P<direction>.*?)\sfor\s(?P<damage>\d*)\spoints")
  3.  
  4. with open("cleanlog.txt","r") as log:
  5.     for line in log:
  6.         print(line)
  7.         m = hitre.match(line)
  8.         if (m!=None):
  9.             print("critical"+m.group('critical'))
  10.             print("attack"+m.group('attack'))
  11.             print("monster"+m.group('monster'))
  12.             print("direction"+m.group('direction'))
  13.             print("damage"+m.group('damage'))
  14.  
  15.  
  16. Your Circle Slash hits the wood weevil from the left for 213 points of damage.
  17.  
  18. critical:
  19. attack: Circle Slash
  20. monster:
  21. direction: wood weevil from the left
  22. damage: 213
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement