【发布时间】:2012-12-06 19:06:33
【问题描述】:
我正在尝试清除 Python 中的代码行,并在 Any way to clear python's IDLE window? 上看到了一篇关于如何执行此操作的帖子,但是当我在 IDLE 3.3 中运行以下函数时,我收到以下错误。但它在 2.7.3 版中确实有效。
错误
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
cls()
File "<pyshell#6>", line 2, in cls
print('\n') * 100
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
代码
def cls():
print('\n') * 100
【问题讨论】:
标签: python-3.x python-2.7