0
我想通過一系列.nc文件來運行一小段代碼。下面的測試腳本打印在目錄中的第一個文件名,但是當我使用ncfile = netCDF4.Dataset(fname, 'r')
我得到的錯誤Python os.walk netCDF4不能一起工作
File "netCDF4\_netCDF4.pyx",
line 1795, in netCDF4._netCDF4.Dataset.__init__
(netCDF4\_netCDF4.c:12278)
RuntimeError: No such file or directory
這是一個不兼容的問題與os.walk和netCDF4或者是一個簡單的錯誤,我在做什麼?
import os
import netCDF4
for root, dirs, files in os.walk('E:\satellite .nc data\ENVISAT2006'):
for fname in files:
print fname # works up to here and without line below it prints all filenames
ncfile = netCDF4.Dataset(fname, 'r')