橘猫啊啊 发表于 2020-5-31 23:48:30

不小心对内置函数赋值了,怎么取消?

本帖最后由 橘猫啊啊 于 2020-5-31 23:49 编辑

不小心对内置函数赋值,怎么取消?
刚看小甲鱼的第3节课,有这样的疑问,希望有大神可以看看我{:5_105:}

Twilight6 发表于 2020-5-31 23:49:27

发代码吧....还有 内置函数是怎么个赋值法???懵

txxcat 发表于 2020-5-31 23:49:48

del 函数名

橘猫啊啊 发表于 2020-5-31 23:52:33

txxcat 发表于 2020-5-31 23:49


>>> print = 'pick'
>>> name ='me'
>>> print(name)
Traceback (most recent call last):
File "<pyshell#29>", line 1, in <module>
    print(name)
TypeError: 'str' object is not callable

Twilight6 发表于 2020-5-31 23:53:28

橘猫啊啊 发表于 2020-5-31 23:52
>>> print = 'pick'
>>> name ='me'
>>> print(name)


重新运行IDLE 就没事了

橘猫啊啊 发表于 2020-5-31 23:53:41

Twilight6 发表于 2020-5-31 23:49
发代码吧....还有 内置函数是怎么个赋值法???懵

>>> print = 'pick'
>>> name ='me'
>>> print(name)
Traceback (most recent call last):
File "<pyshell#29>", line 1, in <module>
    print(name)
TypeError: 'str' object is not callable

橘猫啊啊 发表于 2020-5-31 23:54:29

Twilight6 发表于 2020-5-31 23:53
重新运行IDLE 就没事了

如果前面写了很多代码怎么办呢

Twilight6 发表于 2020-5-31 23:57:42

本帖最后由 Twilight6 于 2020-6-1 00:06 编辑

橘猫啊啊 发表于 2020-5-31 23:54
如果前面写了很多代码怎么办呢

写较多的代码建议别在Shell里面,一般在.py脚本里面写ctrl + n 可以创建脚本文件

txxcat 发表于 2020-5-31 23:58:16

橘猫啊啊 发表于 2020-5-31 23:52
>>> print = 'pick'
>>> name ='me'
>>> print(name)


del print

橘猫啊啊 发表于 2020-6-1 00:10:15

Twilight6 发表于 2020-5-31 23:57
写较多的代码建议别在Shell里面,一般在.py脚本里面写ctrl + n 可以创建脚本文件

谢谢您嘻嘻,这一步我还没学到,但是还是非常感谢您的解答

橘猫啊啊 发表于 2020-6-1 00:11:03

txxcat 发表于 2020-5-31 23:58


get到啦谢谢
页: [1]
查看完整版本: 不小心对内置函数赋值了,怎么取消?