コードを入力してください:ある
listdir(path=None)
Return a list containing the names of the files in the directory.
path can be specified as either str or bytes. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.
は、os.listdir()
はos.listdir('.')
と同じです。
[...]は、os.listdir
は、特に「。」を除外しています。ディレクトリに存在していても '..'と表示されます。どういう意味ですか?
これは戻り値に関係します。 UNIXファイルシステムでは、すべてのディレクトリは、.
と..
のエントリ、 を持ちます。ここで、.
はカレントディレクトリ、 および..
は親ディレクトリです。 ドキュメントでは、これらのエントリはos.listdir
によって返されるリストには含まれないことを示しています。