About the Tutorial



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

os.makedirs() Method 
Description 
The method makedirs() is recursive directory creation function. Like mkdir(), but makes 
all intermediate-level directories needed to contain the leaf directory. 
The default mode is 0o777 (octal). On some systems, mode is ignored. Where it is used, 
the current umask value is first masked out. 
If exist_ok is False (the default), an OSError is raised if the target directory already exists. 
Syntax 
Following is the syntax for makedirs() method- 
os.makedirs(path[, mode]) 
Parameters 

path
- This is the path, which needs to be created recursively. 

mode
- This is the Mode of the directories to be given. 
Return Value 
This method does not return any value. 
Example 
The following example shows the usage of makedirs() method. 
#!/usr/bin/python3 
import os, sys 
# Path to be created 
path = "d:/tmp/home/monthly/daily" 
os.makedirs( path, 493 ) #decimal equivalent of 0755 used on Windows 
print ("Path is created") 
When we run the above program, it produces the following result- 
Path is created 
os.minor() Method 
Description 
The method minor() extracts the device minor number from a raw device number (usually 
the st_dev or st_rdev field from stat). 


Python 3 
289 
Syntax 
Following is the syntax for minor() method- 
os.minor(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 minor number. 
Example 
The following example shows the usage of minor() 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 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   189   190   191   192   193   194   195   196   ...   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