我无法对我的输入进行编码

2024-02-08

if wb == 'Encode a sentence' or wb == 'encode a sentence':
    print("Please enter the Sentence...")
    str = input()
    str = str.encode('base64','strict')
    print(str) 

它告诉我它不能是字节,它们应该是字符串...任何帮助表示赞赏!


你可以试试这个:

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) 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我无法对我的输入进行编码 的相关文章

随机推荐