我想导入Tkinter.但是,我收到一条错误,指出尚未安装Tkinter:
ImportError:没有名为_tkinter的模块,请安装python-tk包
我可以使用synaptic manager安装它(可以吗?),但是,我必须在我编程的每台机器上安装它.是否可以将Tkinter库添加到我的工作区并从那里引用它?
在运行测试以确保两个不同的库提供相同的输出时,我发现它们不具有CFB. 复制问题的代码是:
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from Crypto.Cipher import AES
KEY = b'legoroojlegorooj'
IV = b'legoroojlegorooj'
aes = Cipher(algorithms.AES(KEY), modes.CFB(IV), default_backend()).encryptor()
output_data = aes.update(b'Feathers fall as fast as bowling balls.') + aes.finalize()
del aes
ctr = AES.new(KEY, AES.MODE_CFB, iv=IV)
output_data2 = ctr.encrypt(b'Feathers fall as fast as bowling balls.')
assert output_data == output_data2 # AssertionError
Run Code Online (Sandbox Code Playgroud)
任何解决这个问题的帮助将不胜感激。
此代码适用于modes.OFB(IV)和AES.MODE_OFB。
正如这个问题中所述,我们可以使用装饰器asyncio.coroutine将函数转换为协程,如下所示:
def hello():
print('Hello World!')
async_hello = asyncio.coroutine(hello)
Run Code Online (Sandbox Code Playgroud)
然而,从 python 3.8 开始,这个函数已被弃用(由 替代async def ...)。那么我们如何在 3.8+ 中做到这一点而不需要呢async def ...?
是否有将返回最大N位数的python 3函数?
例:
>>> print(largest_bitsize(8))
255
>>> print(largest_bitsize(16))
65535
Run Code Online (Sandbox Code Playgroud) python ×4
python-3.x ×2
aes ×1
asynchronous ×1
bit ×1
encryption ×1
install ×1
linux ×1
math ×1
pycryptodome ×1
tkinter ×1