def str( number, radix ):
   """str( number, radix ) -- reverse function to int(str,radix) and long(str,radix)"""

   if not 2 <= radix <= 36:
      raise ValueError, "radix must be in 2..36"

   abc = string.digits + string.letters

   result = ''

   if number < 0:
      number = -number
      sign = '-'
   else:
      sign = ''

   while True:
      number, rdigit = divmod( number, radix )
      result = abc[rdigit] + result
      if number == 0:
         return sign + result

   # never here because number >= 0, radix > 0, we repeat (number /= radix)
str( number, radix ) -- reverse function to int(str,radix) and long(str,radix)
recipes/Python/222109_radixstrNR__reverse_functiintSR/recipe-222109.py