Advertisement
Guest User

Untitled

a guest
Nov 17th, 2015
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import fileinput
  2. morguefile = fileinput.input();
  3. counter = 1
  4. cause = ""
  5.  
  6. #Read and parse file
  7. for line in morguefile:
  8.     line=line.lstrip()
  9.     line = " ".join(line.split())
  10.     if line != "":
  11.         words = line.split(" ")
  12.         if counter == 1:
  13.             version = words[5]
  14.         elif counter == 3:
  15.             score = words[0]
  16.             name = " ".join(words[1:4])
  17.             level = words[5]
  18.         elif counter == 4:
  19.             if len(words) == 9:
  20.                 classrace = " ".join(words[3:5])
  21.             elif len(words) == 10:
  22.                 classrace = " ".join(words[3:6])
  23.             else:
  24.                 classrace = " ".join(words[3:7])
  25.         elif counter == 5:
  26.             if words[0:3] != ["Was", "the", "Champion"]:
  27.                 cause = " ".join(words)
  28.         elif counter == 6:
  29.             cause += " ".join(words)
  30.         elif counter == 7:
  31.             cause += " ".join(words)
  32.         elif counter == 8:
  33.             cause += " ".join(words)
  34.         elif counter == 9:
  35.             turns = words[4].replace("(","")
  36.     counter += 1
  37.  
  38. cause = cause.replace("\n","").replace("\r","").replace("...","")
  39.  
  40.  
  41. #Start printing
  42. print "Version: " + version
  43. print "Score: " + score
  44. print "Name: " + name
  45. print "Level: " + level[0:len(level)-1]
  46. print "Species & Background: " + classrace
  47. print "Cause of Death/Victory: " + cause
  48. print "Turns: " + turns
Advertisement
RAW Paste Data Copied
Advertisement