2005年09月11日 星期日 14:58
比如file对象的closed和mode属性
当执行
file1=open("c:\\1.txt","r")
a=file1.mode()
这段代码后要报错:TypeError: 'str' object is not callable
什么原因?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050911/4b806c1d/attachment.htm
2005年09月11日 星期日 15:38
看help(file) Data and non-method functions defined here: ... mode ... 他只是data,直接引用就行了. >>>file1.mode 'r' On 9/11/05, Lee DYER <lee.dyer at gmail.com> wrote: > 比如file对象的closed和mode属性 > 当执行 > file1=open("c:\\1.txt","r") > a=file1.mode() > 这段代码后要报错:TypeError: 'str' object is not callable > 什么原因? >
Zeuux © 2025
京ICP备05028076号