About the Tutorial



Download 2,85 Mb.
Pdf ko'rish
bet187/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   183   184   185   186   187   188   189   190   ...   234
Bog'liq
python3 tutorial 060821094426

os.lchflags() Method 
Description 
The method lchflags() sets the flags of path to the numeric flags. This method does not 
follow symbolic links unlike chflags() method. As of Python 3.3, this is equivalent to 
os.chflags(path, flags, follow_symlinks=False). 
Here, flags may take a combination (bitwise OR) of the following values (as defined in the 
stat module): 

UF_NODUMP: Do not dump the file. 

UF_IMMUTABLE: The file may not be changed. 

UF_APPEND: The file may only be appended to. 

UF_NOUNLINK: The file may not be renamed or deleted. 

UF_OPAQUE: The directory is opaque when viewed through a union stack. 

SF_ARCHIVED: The file may be archived. 

SF_IMMUTABLE: The file may not be changed. 

SF_APPEND: The file may only be appended to. 

SF_NOUNLINK: The file may not be renamed or deleted. 

SF_SNAPSHOT: The file is a snapshot file. 
Note:
This method has been introduced in Python 2.6 
Syntax 
Following is the syntax for lchflags() method- 
os.lchflags(path, flags) 
Parameters 

path
- This is the file path for which flags to be set. 

flags
- This could be a combination (bitwise OR) of the above defined flags values. 
Return Value 
This method does not return any value. Available on Unix like systems. 
Example 
The following example shows the usage of lchflags() method. 


Python 3 
279 
#!/usr/bin/python3 
import os, sys 
# Open a file 
path = "/var/www/html/foo.txt" 
fd = os.open( path, os.O_RDWR|os.O_CREAT ) 
# Close opened file 
os.close( fd ) 
# Now change the file flag. 
ret = os.lchflags(path, os.UF_IMMUTABLE ) 
print ("Changed file flag successfully!!") 
When we run the above program, it produces the following result- 
Changed file flag successfully!! 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   183   184   185   186   187   188   189   190   ...   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