Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5647c473
Kaydet (Commit)
5647c473
authored
Mar 10, 2011
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge #10999 fix.
üst
f2b5673f
30178068
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
32 deletions
+77
-32
os.rst
Doc/library/os.rst
+10
-10
stat.rst
Doc/library/stat.rst
+66
-22
ACKS
Misc/ACKS
+1
-0
No files found.
Doc/library/os.rst
Dosyayı görüntüle @
5647c473
...
...
@@ -965,16 +965,16 @@ Files and Directories
Set the flags of *path* to the numeric *flags*. *flags* may take a combination
(bitwise OR) of the following values (as defined in the :mod:`stat` module):
*
``UF_NODUMP`
`
*
``UF_IMMUTABLE`
`
*
``UF_APPEND`
`
*
``UF_OPAQUE`
`
*
``UF_NOUNLINK`
`
*
``SF_ARCHIVED`
`
*
``SF_IMMUTABLE`
`
*
``SF_APPEND`
`
*
``SF_NOUNLINK`
`
*
``SF_SNAPSHOT`
`
*
:data:`stat.UF_NODUMP
`
*
:data:`stat.UF_IMMUTABLE
`
*
:data:`stat.UF_APPEND
`
*
:data:`stat.UF_OPAQUE
`
*
:data:`stat.UF_NOUNLINK
`
*
:data:`stat.SF_ARCHIVED
`
*
:data:`stat.SF_IMMUTABLE
`
*
:data:`stat.SF_APPEND
`
*
:data:`stat.SF_NOUNLINK
`
*
:data:`stat.SF_SNAPSHOT
`
Availability: Unix.
...
...
Doc/library/stat.rst
Dosyayı görüntüle @
5647c473
...
...
@@ -76,6 +76,34 @@ for each test. These are also useful when checking for information about a file
that isn't handled by :mod:`os.path`, like the tests for block and character
devices.
Example::
import os, sys
from stat import *
def walktree(top, callback):
'''recursively descend the directory tree rooted at top,
calling the callback function for each regular file'''
for f in os.listdir(top):
pathname = os.path.join(top, f)
mode = os.stat(pathname)[ST_MODE]
if S_ISDIR(mode):
# It's a directory, recurse into it
walktree(pathname, callback)
elif S_ISREG(mode):
# It's a file, call the callback function
callback(pathname)
else:
# Unknown file type, print a message
print('Skipping %s' % pathname)
def visitfile(file):
print('visiting', file)
if __name__ == '__main__':
walktree(sys.argv[1], visitfile)
All the variables below are simply symbolic indexes into the 10-tuple returned
by :func:`os.stat`, :func:`os.fstat` or :func:`os.lstat`.
...
...
@@ -265,31 +293,47 @@ The following flags can also be used in the *mode* argument of :func:`os.chmod`:
Unix V7 synonym for :data:`S_IXUSR`.
Example:
:
The following flags can be used in the *flags* argument of :func:`os.chflags`
:
import os, sys
from stat import *
.. data:: UF_NODUMP
def walktree(top, callback):
'''recursively descend the directory tree rooted at top,
calling the callback function for each regular file'''
Do not dump the file.
for f in os.listdir(top):
pathname = os.path.join(top, f)
mode = os.stat(pathname)[ST_MODE]
if S_ISDIR(mode):
# It's a directory, recurse into it
walktree(pathname, callback)
elif S_ISREG(mode):
# It's a file, call the callback function
callback(pathname)
else:
# Unknown file type, print a message
print('Skipping %s' % pathname)
.. data:: UF_IMMUTABLE
def visitfile(file):
print('visiting', file)
The file may not be changed.
if __name__ == '__main__':
walktree(sys.argv[1], visitfile)
.. data:: UF_APPEND
The file may only be appended to.
.. data:: UF_OPAQUE
The file may not be renamed or deleted.
.. data:: UF_NOUNLINK
The directory is opaque when viewed through a union stack.
.. data:: SF_ARCHIVED
The file may be archived.
.. data:: SF_IMMUTABLE
The file may not be changed.
.. data:: SF_APPEND
The file may only be appended to.
.. data:: SF_NOUNLINK
The file may not be renamed or deleted.
.. data:: SF_SNAPSHOT
The file is a snapshot file.
See the \*BSD or Mac OS systems man page :manpage:`chflags(2)` for more information.
Misc/ACKS
Dosyayı görüntüle @
5647c473
...
...
@@ -619,6 +619,7 @@ Stefan Norberg
Tim Northover
Joe Norton
Neal Norwitz
Michal Nowikowski
Nigel O'Brian
Kevin O'Connor
Tim O'Malley
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment