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

沒有留言:

張貼留言

WOKWI ESP32 LED Control , Node-Red MQTT SQLITE  

WOKWI ESP32 LED Control ,  Node-Red  MQTT SQLITE   const char broker[] = "test.mosquitto.org" ; //const char broker[] = "br...