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
>>> 

沒有留言:

張貼留言

經由MQTT協定的2個WOKWI ESP32 雙向通訊 (ESP32 to ESP32 MQTT Communication )

 經由MQTT協定的2個WOKWI ESP32 雙向通訊  (ESP32  to ESP32 MQTT Communication ) 使用兩個 ESP32 建立一個遠端控制系統。 MQTT Broker: mqtt-dashboard.com Topic (主題): ale...