About the Tutorial



Download 2,85 Mb.
Pdf ko'rish
bet192/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   188   189   190   191   192   193   194   195   ...   234
Bog'liq
python3 tutorial 060821094426

os.major() Method 
Description 
The method major() extracts the device major number from a raw device number (usually 
the st_dev or st_rdev field from stat). 
Syntax 
Following is the syntax for major() method- 
os.major(device) 
Parameters 
device
- This is a raw device number (usually the st_dev or st_rdev field from stat). 
Return Value 
This method returns the device major number. 
Example 
The following example shows the usage of major() method. 
#!/usr/bin/python3 
import os, sys 
path = "/var/www/html/foo.txt" 
# Now get the touple 
info = os.lstat(path) 
# Get major and minor device number 
major_dnum = os.major(info.st_dev) 
minor_dnum = os.minor(info.st_dev) 
print ("Major Device Number :", major_dnum) 
print ("Minor Device Number :", minor_dnum) 
When we run the above program, it produces the following result- 
Major Device Number : 0 
Minor Device Number : 103 
os.makedev() Method 
Description 


Python 3 
287 
The method makedev() composes a raw device number from the major and minor device 
numbers. 
Syntax 
Following is the syntax for makedev() method- 
os.makedev(major, minor) 
Parameters 

major
- This is Major device number. 

minor
- This is Minor device number. 
Return Value 
This method returns the device number. 
Example 
The following example shows the usage of makedev() method. 
#!/usr/bin/python3 
import os, sys 
path = "/var/www/html/foo.txt" 
# Now get the touple 
info = os.lstat(path) 
# Get major and minor device number 
major_dnum = os.major(info.st_dev) 
minor_dnum = os.minor(info.st_dev) 
print ("Major Device Number :", major_dnum) 
print ("Minor Device Number :", minor_dnum) 
# Make a device number 
dev_num = os.makedev(major_dnum, minor_dnum) 
print ("Device Number :", dev_num) 
When we run the above program, it produces the following result- 
Major Device Number : 0 
Minor Device Number : 103 
Device Number : 103 


Python 3 
288 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   188   189   190   191   192   193   194   195   ...   234




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish