2018年1月10日 星期三

Python: Retrieve file properties

Python: Retrieve file properties檢索檔案屬性

Python Basic: Exercise-107 with Solution

Write a Python program to retrieve file properties.
Sample Solution:-

import os.path
import time

print('File         :', __file__)
print('Access time  :', time.ctime(os.path.getatime(__file__)))
print('Modified time:', time.ctime(os.path.getmtime(__file__)))
print('Change time  :', time.ctime(os.path.getctime(__file__)))
print('Size         :', os.path.getsize(__file__))


======= RESTART: F:/Python_APSC/py-ex-basic-107.py ===========
File         : F:/Python_APSC/py-ex-basic-107.py
Access time  : Thu Jan 11 00:00:00 2018
Modified time: Thu Jan 11 15:15:06 2018
Change time  : Thu Jan 11 15:15:04 2018
Size         : 313
>>> 

沒有留言:

張貼留言

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red 1) 安裝Node-Red  https://ithelp.ithome.com.tw/articles/10201795 https://www.youtube.com/watch?v...