Drkcore

27 05 2014 Python Tweet

あるディレクトリにあるファイルのなかで一番新しく作られたものを調べる(Python)

globとosモジュールを使う

>>> import os, glob
>>> max(glob.iglob('*.txt'), key=os.path.getctime)
'list_sample.txt'

参考

  • Python: Find newest file with .MP3 extension in directory

ProductName みんなのPython 第3版
柴田 淳
SBクリエイティブ株式会社 / ?円 ( 2013-12-04 )


About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021