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

沒有留言:

張貼留言

2026 作業1 MQTT基本觀念

 2026 作業1MQTT基本觀念 作業  參考下面網址 https://alex9ufoexploer.blogspot.com/2025/02/1-mqtt-relay-dht22-mqtt-box-pc-mymqtt.html https://alex9ufoexploer...