本文介绍了内置函数不能与Spyder一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
内核硬启动( ctrl + 。) 后续这个功能请求线程,现在可以在每次运行脚本时自动清除名称空间。
A hard restart of the Kernel (ctrl + .)
Follow up on this feature request thread where it's now possible to clear the namespace automatically every time you run a script.
我试图在Python 3,6中使用max函数:
I'm trying to use the max function in Python 3,6:
print('Maximum is:', max(1, 3, 2, 5, 4))结果是
File "E:/ProgramyRobione/untitled1.py", line 2, in <module> print('Maximum is:', max(1, 3, 2, 5, 4)) TypeError: 'int' object is not callable我使用Spyder,该行是代码应该执行的所有操作。
I'm using Spyder and that line is all that code should do.
推荐答案这是Spyder附带的一个iPython头像。当从几秒后复制/粘贴随机代码片段来测试以发现非常奇怪的行为时,我已经陷入了这种情况 - 在iPython控制台中定义的变量也将无限期地放在脚本的全局名称空间中。
This is a bit of an iPython headshot that comes with Spyder. I've fallen foul of this when copy/pasting random bits of code from SO to test only to find really odd behaviour several days later - variables defined in the iPython console will also be in the script's global namespace indefinitely.
您可以执行以下两项操作:
There's two things you can do:
更多推荐
内置函数不能与Spyder一起使用
发布评论