wbrigg

idtarg

Mar 8th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. states = {}
  2. states_order = []
  3. with open("fort.24") as f:
  4.   for line in f:
  5.     if line[0] == "5":
  6.       state_no, spin, sym = line.split()[-3:]
  7.      
  8.       spin_sym = spin + sym
  9.      
  10.       states[int(state_no)] = spin_sym
  11.      
  12.       if spin_sym not in states_order:
  13.         states_order.append(spin_sym)
  14.      
  15. idtarg = []    
  16. for spin_sym in states_order:
  17.   for state_no in states.keys():
  18.     if states[state_no] == spin_sym:
  19.       idtarg.append(state_no)
  20.  
  21.  
  22. print idtarg
Advertisement
Add Comment
Please, Sign In to add comment