You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
1.1 ディレクトリ内の全てのファイルをリストする import sys, os if len(sys.argv) != 2: sys.exit("a single argument (the directory name) is required") try: filenames = os.listdir(sys.argv[1]) except OSError: sys.exit("can't open {0}".format(sys.argv[1])) for filename in filenames: print filename sys.exit(0) Pythonでは、opendir()/readdir()/closedir()を個別に呼び出す必要はなく、os.listdir()だけでファイル一覧を取得することができる。ただし、readdir()と違って、os.listdir(
http://d.hatena.ne.jp/jYoshiori/20090121/1232526865 autotestか!っていうコードだけど。 Linuxならpyinotifyを使えばいいんじゃないかな。 from pyinotify import WatchManager, Notifier, IN_MODIFY, ProcessEvent wm = WatchManager() mask = IN_MODIFY class PTmp(ProcessEvent): def process_IN_MODIFY(self, event): print "m: %s" % event.name notifier = Notifier(wm, PTmp()) wdd = wm.add_watch('../', mask, rec=True) notifier.loop() directory
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く