Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. def parse(fdl):
  2. files = open(fdl)
  3. command = {}
  4. rule = []
  5. for line in files:
  6. line = line.strip()
  7. splitted = line.split()
  8. if splitted == 'start':
  9. start = splitted[1:]
  10. elif splitted[0] == 'rule':
  11. rule.append((splitted[1],splitted[3:]))
  12. elif splitted[0] =='cmd':
  13. cmd = (splitted[2],splitted[3:])
  14. command[splitted[1]] = cmd
  15. elif splitted[0] == 'length':
  16. length = int(splitted[1])
  17. elif splitted[0] == 'depth':
  18. depth = int(splitted[1])
  19. return start,rule,commands,length,depth
  20.  
  21. parse(fern)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement