【问题标题】:python AttributeError: module 'math' has no attribute 'comb'python AttributeError:模块'math'没有属性'comb'
【发布时间】:2021-04-16 08:12:07
【问题描述】:

我在尝试使用“梳子”功能时遇到错误:

$ python
Python 3.7.1 (default, Dec 14 2018, 13:28:58) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> print(math.comb(6,49))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute 'comb'
>>> 

【问题讨论】:

    标签: math python-3.7 comb


    【解决方案1】:

    comb 函数是 Python 3.8 中的新功能(请参阅文档 here)。你的 Python 安装是 3.7.1。如果您更新 Python 安装,该问题应该会得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-28
      • 2023-04-06
      • 2018-06-16
      • 2015-03-09
      • 2020-10-18
      • 2016-12-26
      • 2016-04-10
      • 2017-04-07
      相关资源
      最近更新 更多