How do I solve TypeError: pow() takes exactly 2 arguments (3 given)?

How do I solve TypeError: pow() takes exactly 2 arguments (3 given)?

我做了一个可以解决RSA数学问题的小程序。程序的一部分检查是否需要密文,如果需要明文,则给出e和n。

执行代码时出现错误: TypeError: pow() 恰好接受 2 个参数(给定 3 个) 尽管 pow() 可以接受 3 个参数 https://www.programiz.com/python-programming/methods/built-in/pow

if "ciphertext" in NeededObjDict and "plaintext" in GivenObjDict and "e" in GivenObjDict and "n" in GivenObjDict:
        OutputCiphertext = str(pow(GivenPlaintext, GivenE, GivenN))
        print('ciphertext = ',OutputCiphertext)

我想我找到了您问题的原因。内置 pow 函数采用三个参数,如 here. However the math.pow function takes in two arguments, as seen here

我会检查您是否从某处 math 导入 pow