我无法检查目录中的可用文件

I am unable to check the files available in the directory

我正在尝试读取当前目录中的 csv 文件。为此,我想检查当前目录中存在的所有文件。我试过用 check_output 函数来做。但是,我收到了这个错误,我无法弄清楚如何处理它。这是我试过的代码:

from subprocess import check_output
print(check_output(["ls","../input"]).decode('utf8'))

这是我收到的错误:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-15-c18143c64098> in <module>
      1 from subprocess import check_output
----> 2 print(check_output(["ls","../input"]).decode('utf8'))

~\Anaconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
    393 
    394     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 395                **kwargs).stdout
    396 
    397 

~\Anaconda3\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    470         kwargs['stderr'] = PIPE
    471 
--> 472     with Popen(*popenargs, **kwargs) as process:
    473         try:
    474             stdout, stderr = process.communicate(input, timeout=timeout)

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

您可以通过执行此操作获取当前目录中所有文件的列表:

import os
files = os.listdir('./')