小编ver*_*app的帖子

端口Python v2功能到v3

在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版本吗?

python

1
推荐指数
1
解决办法
1126
查看次数

Tkinter有效吗?

我从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个按钮的窗口'.想法?

python tkinter python-3.x

1
推荐指数
1
解决办法
668
查看次数

标签 统计

python ×2

python-3.x ×1

tkinter ×1