else
This commit is contained in:
parent
fa71076e40
commit
34d495fd6a
1 changed files with 2 additions and 2 deletions
|
@ -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')
|
||||||
|
|
Loading…
Reference in a new issue