本文介绍了为什么我的代码会打印“内置方法"?还有一些十六进制数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的主要功能:

def Key(message, decision):
    key = input("Input the key which will be used to encode the message.\n".lower)
    n = 0
    for i in range(len(key)):
        if 64 < ord(key[n]) < 91:
            raise ValueError(key[n], "is a capital letter!")
        else:
            n = n+1
    Keycode(decision, message, key)

当我调用它并输入消息并按Enter时,它会显示:

When I call it and input the message and press enter it comes up with:

怎么了?我该如何解决?

What's wrong? How can I fix it?

推荐答案

Key 包含以下问题行:

key = input("Now, input the key which will be used to encode the message.\n".lower)

作为输入传递给 input 字符串的 lower 方法,当(大概)想要传递字符串然后应用 lower 输入 input 返回的内容.

which passes as input to input the lower method of a string, when you (presumably) want to pass the string and then apply lower to what input returns.

这篇关于为什么我的代码会打印“内置方法"?还有一些十六进制数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:41