在v3中运行时,此v2函数提供"NameError:全局名称'文件'未定义"错误.
def from_file(filename, sep='\n'):
"Parse a file into a list of strings, separated by sep."
return file(filename).read().strip().split(sep)
Run Code Online (Sandbox Code Playgroud)
有人可以提供v3版本吗?
我从http://wiki.python.org/moin/TkInter安装了Python 3.2 .
第3步 - Tkinter工作吗?
在Python提示符下尝试以下命令:
Tkinter._test()#note _core中的下划线.此外,如果您使用的是Python 3.1,请尝试使用tkinter._test().这应该会弹出一个带有两个按钮的小窗口.
>>> Tkinter._test
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
Tkinter._test
NameError: name 'Tkinter' is not defined
>>> tkinter._test
<function _test at 0x00000000028FD2C8>
Run Code Online (Sandbox Code Playgroud)
但是,没有'带2个按钮的窗口'.想法?