base64encode(ntei)
「Heres the number in base 64:」の下に新しい行を追加したいのですが、方法を知っている人はいますか?
import easygui as e
nte = e.enterbox(msg="Enter Number to convert", title="", default="", strip=True)
ntei = int(nte)
def base64encode(number, alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"):
"""Converts an integer to a base64 string."""
if not isinstance(number, (int, long)):
raise TypeError("Number must be an integer")
base64 = ""
sign = ""
if number < 0:
sign = "_"
number = -number
if 0 <= number <len(alphabet):
return sign + alphabet[number]
while number !=0:
number, i = divmod(number, len(alphabet))
base64 = alphabet[i] + base64
return sign + base64
def base60decode(number):
return int(number, 64)
print e.msgbox(msg=("Heres the number in base 64: " + base64encode(ntei)))