Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 你好谁能告诉我什么';这段代码是怎么回事。谁能解释一下';这里发生了什么事_Python 2.7 - Fatal编程技术网

Python 2.7 你好谁能告诉我什么';这段代码是怎么回事。谁能解释一下';这里发生了什么事

Python 2.7 你好谁能告诉我什么';这段代码是怎么回事。谁能解释一下';这里发生了什么事,python-2.7,Python 2.7,我是python新手,所以对它了解不多 这是代码 import string def ispangram(string1,alphabet = string.ascii_lowercase): alphaset = set(alphabet) alpha = set(string1.lower()) return alphaset <= alpha ispangram("The quick brown

我是python新手,所以对它了解不多

这是代码

    import string

    def ispangram(string1,alphabet = string.ascii_lowercase):

         alphaset = set(alphabet)

         alpha = set(string1.lower())

         return alphaset <= alpha

    ispangram("The quick brown fox jumps over the lazy dog")
导入字符串
def ispangram(字符串1,字母表=字符串。ascii_小写):
字母集=集合(字母表)
alpha=set(string1.lower())

返回字母集pangram是一个包含字母表中每个字母的句子

此代码询问“输入中是否有(字母表中的所有字母)”

  • 字母表中的所有字母都来自内置模块
    string.ascii\u小写

  • 为了使比较适用于
    the
    the
    ,使用
    lower()
    将输入转换为小写


  • 比较是使用集合(Python的集合类型之一)完成的。当操作员
    我试图回答它时,为了问一个更好的问题,你应该真正解释你在代码中做了什么和不理解什么,以及你试图在哪里查找它。我猜这是使用