如何使用此命令检查文件“file_name”是否仍然打开?
csv_gen = (row for row in open(file_name))
Run Code Online (Sandbox Code Playgroud)
我知道我们应该使用类似的东西
with open(file_name) as file_name_ref:
csv_gen = (row for row in file_name_ref)
Run Code Online (Sandbox Code Playgroud)
但是发生了什么,如果我使用以前的命令,我该如何检查行为。
Searching Python 3.6 libraries...
Found Python library: /home/luan/anaconda3/envs/za/lib/libpython3.6m.so
Found Python headers folder: /home/luan/anaconda3/envs/za/include/python3.6m
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check …
Run Code Online (Sandbox Code Playgroud)