我在jupyter 中运行两个数字的加法
'''
This program `summationoftwonumbers` and displays their results
'''
A = 1
B = 5
print('Sum of Numbers:',A+B)
它运行良好,输出为"Sum of Numbers: 6"
但是,当使用PyLint运行文件时,summationoftwonumber.ipynb
会出现以下错误。
summationoftwonumbers.ipynb:1:0: C0114: Missing module docstring (missing-module-docstring)
summationoftwonumbers.ipynb:1:0: W0104: Statement seems to have no effect (pointless-statement)
我不明白为什么会发生这种事。
您使用引号来编写注释,在某些情况下会创建一个文档字符串。Python警告您,该语句在您的程序中没有任何效果。要消除警告,您可以重写以下行:
''' This program summationoftwonumbers and displays their results '''
作为一个正常的评论:
# This program summationoftwonumbers and displays their results