我参加的大学早期课程之一是 3 年前的 Python 基础培训。现在我正在寻找一个可以帮助我调整一些 Grid 东西大小的程序,我发现了一些可以在 Python 中帮助我的东西。我将 Python 重新安装到我的 PC 并找到了我的旧编辑器。但是,当我运行代码时,我得到一个我无法理解的无效语法错误。这是出现错误的代码部分:
def downsize(mode, cell_size, inpath, outpath):
from VolumeData import fileformats
try:
grid_data = fileformats.open_file(inpath)
except fileformats.Uknown_File_Type, e:
sys.stderr.write(str(e))
sys.exit(1)
reduced = Reduced_Grid(grid_data, mode, cell_size)
from VolumeData.netcdf.netcdf_grid import write_grid_as_netcdf
write_grid_as_netcdf(reduced, outpath)
确切的无效语法错误在“除了 fileformats.Uknown_File_Type, e:”行中。你能帮助我吗 ?