if wb == 'Encode a sentence' or wb == 'encode a sentence':
print("Please enter the Sentence...")
str = input()
str = str.encode('base64','strict')
print(str)
それはバイトではないことを私に伝えます。文字列でなければなりません。私の入力を符号化できません
if wb == 'Encode a sentence' or wb == 'encode a sentence':
print("Please enter the Sentence...")
str = input()
str = str.encode('base64','strict')
print(str)
それはバイトではないことを私に伝えます。文字列でなければなりません。私の入力を符号化できません
はこれを試してみてください。
にもfrom base64 import b64encode
b64encode(wb.encode())
あなたの行は、この
if wb.lower() == 'encode a sentence':
ありがとう!たくさんの私の友人 –
を使用する場合は、これを試すことができます。
import base64
if wb == 'Encode a sentence' or wb == 'encode a sentence':
print("Please enter the Sentence...")
str = input()
base64.b64encode(bytes(str, 'utf-8'))
print(str)
あなたが使用しているのPythonのバージョンは何? –
私はPython 3.5.0を使っています –
サイドノートでは、 'str'の代わりに別の変数名を使用するのが最善でしょう。これはPythonのビルトインで、' str.encode( 'my文字列 ') ' –