リンク
ちゃんと調べるときは
http://www.python.jp/doc/release/
Wiki内検索
最近更新したページ
最新コメント
文字コードの判定 by awesome things!
正規表現 by awesome things!
辞書 by stunning seo guys
文字列の16進変換 by check it out
文字コードの変換 by check this out
デバッガ by check this out
サブプロセス by watch for this
文字コードの判定 by watch for this
サニタイジング by check this out
タグ

ディレクトリ

作成

os.mkdir(ディレクトリの名前)

削除

os.rmdir(ディレクトリの名前)
例によって空じゃないと削除できない。 -fみたいなオプションもない。

*強制的にディレクトリ以下を消してしまいたい

shutil.rmtree(ディレクトリの名前)
で行ける。

あるかどうか

os.path.exists(ディレクトリの名前)

*ディレクトリかどうか

os.path.isdir(ディレクトリの名前)

内容一覧の取得

>>> os.listdir(".")
['directory1', 'file1.txt']
>>> 
2008年09月17日(水) 15:24:41 Modified by hebi_




スマートフォン版で見る