Python返回错误,但代码正常

时间:2019-08-01 08:49:16

标签: python python-3.x

我写了一个查找日历月份的小代码,但是python返回错误

bd-22.10.94|Marry|Scott|Robinson|

现在,当我使用“ python3 calendar.py”在kali linux中运行此代码时。它返回此错误。.

# First import the calendar module

import calendar

# ask of month and year

yy = int(input("Enter year: "))
mm = int(input("Enter month: "))

# display the calendar

print(calendar.month(yy, mm))

当我在某些在线python解释器中运行此命令时,效果很好。

1 个答案:

答案 0 :(得分:1)

因为您将Python脚本命名为“ calendar.py”。它正在导入当前文件而不是实际模块。更改名称即可使用。