(the_dict)
Given dict the_dict, recursively converts all integers into strings.
Given dict the_dict, recursively converts all integers into strings.
Given dict the_dict recursively converts all integers into strings .
def TurnIntIntoStrInDict(the_dict):
  """Given dict the_dict, recursively converts all integers into strings.
  """
  # Use items instead of iteritems because there's no need to try to look at
  # reinserted keys and their associated values.
  for k, v in the_dict.items():
    if type(v) is int:
      v = str(v)
      the_dict[k] = v
    elif type(v) is dict:
      TurnIntIntoStrInDict(v)
    elif type(v) is list:
      TurnIntIntoStrInList(v)

    if type(k) is int:
      del the_dict[k]
      the_dict[str(k)] = v
def TurnIntIntoStrInDict ( the_dict ) : # Use items instead of iteritems because there's no need to try to look at # reinserted keys and their associated values. for k , v in the_dict . items ( ) : if type ( v ) is int : v = str ( v ) the_dict [ k ] = v elif type ( v ) is dict : TurnIntIntoStrInDict ( v ) elif type ( v ) is list : TurnIntIntoStrInList ( v ) if type ( k ) is int : del the_dict [ k ] the_dict [ str ( k ) ] = v