This commit is contained in:
unknown 2015-07-05 19:29:33 -07:00
parent fa71076e40
commit 34d495fd6a

View file

@ -12,8 +12,8 @@ TERMINALWIDTH = shutil.get_terminal_size().columns
def basex(number, base, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'): def basex(number, base, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Converts an integer to a different base string.""" """Converts an integer to a different base string."""
if base > len(alphabet): if base > len(alphabet):
raise Exception('alphabet "%s" does not support base %d' % ( raise Exception('alphabet %s does not support base %d' % (
alphabet, base)) repr(alphabet), base))
alphabet = alphabet[:base] alphabet = alphabet[:base]
if not isinstance(number, (int, str)): if not isinstance(number, (int, str)):
raise TypeError('number must be an integer') raise TypeError('number must be an integer')