0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

python:現在のパスとその中のファイル一覧取得及びファイルの存在有無の確認

Last updated at Posted at 2019-02-15

備忘録です.

pythonで現在のパスとそのパス内にあるファイルの取得方法です.

import os

print(os.getcwd()) # can see the path to the current working directory.
print(os.listdir(os.getcwd())) # can see the list of the files in the current working directory.

その他にあるファイルが存在するか否かを見るためにはこの記事が参考になります.

import os

os.path.exists(path)
os.path.isfile(path)
os.path.isdir(path)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?