Python でファイルの変更日時を取得するにはどうすればよいですか?[重複]

StackOverflow https://stackoverflow.com/questions/121025

  •  02-07-2019
  •  | 
  •  

質問

Python でファイルの変更日時を取得するにはどうすればよいですか?

役に立ちましたか?

解決

os.path.getmtime(filepath)

または

os.stat(filepath).st_mtime

他のヒント

フォーマット済み:

import time
print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname)))
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top