Phương thức os.major(device) trích xuất major device number từ raw device number (thường là trường st_dev hoặc st_rdev từ stat).
Ví dụ
Để dùng phương thức này, cần raw device number. Dùng như sau:
import os, sys
path = "/var/www/html/foo.txt"
# Lấy stat tuple
info = os.lstat(path)
# Lấy major device number
major_dnum = os.major(info.st_dev)
print("Major Device Number :", major_dnum)
Kết quả
Sẽ cho ra:
Major Device Number : 0