端口Python v2功能到v3

ver*_*app 1 python

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

Mat*_*hen 7

file通话更改为open.