Vous devez avoir un compte Developpez.com et être connecté pour pouvoir participer aux discussions.

Mot de passe
Mot de passe oublié ?
Créer un compte

Vous n'avez pas encore de compte Developpez.com ? L'inscription est gratuite et ne vous prendra que quelques instants !

Je m'inscris !



Choisissez la catégorie, puis la rubrique :

36.2.1 File Operations

36.2.1 File Operations

locking( fd, mode, nbytes)
Lock part of a file based on file descriptor fd from the C runtime. Raises IOError on failure. The locked region of the file extends from the current file position for nbytes bytes, and may continue beyond the end of the file. mode must be one of the LK_* constants listed below. Multiple regions in a file may be locked at the same time, but may not overlap. Adjacent regions are not merged; they must be unlocked individually.

Locks the specified bytes. If the bytes cannot be locked, the program immediately tries again after 1 second. If, after 10 attempts, the bytes cannot be locked, IOError is raised.

Locks the specified bytes. If the bytes cannot be locked, IOError is raised.

Unlocks the specified bytes, which must have been previously locked.

setmode( fd, flags)
Set the line-end translation mode for the file descriptor fd. To set it to text mode, flags should be os.O_TEXT; for binary, it should be os.O_BINARY.

open_osfhandle( handle, flags)
Create a C runtime file descriptor from the file handle handle. The flags parameter should be a bit-wise OR of os.O_APPEND, os.O_RDONLY, and os.O_TEXT. The returned file descriptor may be used as a parameter to os.fdopen() to create a file object.

get_osfhandle( fd)
Return the file handle for the file descriptor fd. Raises IOError if fd is not recognized.

See About this document... for information on suggesting changes.
Contacter le responsable de la rubrique Python

Partenaire : Hébergement Web