def parse_sudoku_assignment(grid):
 digits = re.sub('\\s', '', grid)
 assert (len(digits) == 81)
 digit = iter(digits)
 asg = {}
 for row in range(9):
  for col in range(9):
   d = int(digit.next())
   if (d > 0):
    asg[(row, col)] = d
 return asg

def parse_sudoku_assignment ( grid ) : digits = re . sub ( '\\s' , '' , grid ) assert ( len ( digits ) == 81 ) digit = iter ( digits ) asg = { } for row in range ( 9 ) : for col in range ( 9 ) : d = int ( digit . next ( ) ) if ( d > 0 ) : asg [ ( row , col ) ] = d return asg
given a string of 81 digits .