with NamedTemporaryFile(suffix='.shp').name as tmp_shp:
df.to_file(tmp_shp)
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我收到此错误:
with NamedTemporaryFile(suffix='.shp').name as tmp_shp:
df.to_file(tmp_shp)
Run Code Online (Sandbox Code Playgroud)
如何使用 with 语句使用命名临时文件?既然tmp_shp只是一条路径,它在 之外仍然可用吗with?