math - python AttributeError:模块'math'没有属性'comb'
问题描述
当我尝试使用“comb”功能时出现错误:
$ 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'
>>>
解决方案
comb 函数是 Python 3.8 中的新功能(请参阅此处的文档)。你的 Python 安装是 3.7.1。如果您更新 Python 安装,则该问题应该得到解决。
推荐阅读
- python - AWS Lambda Policy Length Exceeded - 向 lambda 函数添加规则
- c# - 如何处理因 INotifyPropertyChanged 事件导致的内存泄漏问题?
- python - 如何在 Windows 10 PC 上使用 Python 3.7 和 Mutagen 写入 ID3 标签 WFED URL 框架
- c# - Model Binding with Nested JSON Objects
- javascript - 如何插入 HTML 内容而不用 JS 覆盖默认内容
- mono - How to build historgram of methods by time spent inside with Mono?
- json - 如何使用 VBScript 或批处理文件从 JSON 文件中下载和获取值?
- javascript - Orderby dictionary like data structure by value angular
- python - 将列附加到包含另一行重复计数的数据框
- c# - 使用 ElasticSearch 过滤产品 concat a lot of filter