PYTHON PROGRAMMING (2010)

Operating System methods

os.fchdir(fd)- Change the current working directory to the directory represented by the file descriptor fd.

os.fchmod(fd, mode)- Change the mode of the file given by fd to the numeric mode.

os.fchown(fd, uid, gid)- Change the owner and group id of the file given by fd to the numeric uid and gid.

os.fdatasync(fd)- Force write of file with filedescriptor fd to disk.

os.fdopen(fd[, mode[, bufsize]])- Return an open file object connected to the file descriptor fd.

os.fpathconf(fd, name)- Return system configuration information relevant to an open file. name specifies the configurationvalue to retrieve.

os.fstat(fd)- Return status for file descriptor fd.

os.fstatvfs(fd)- Return information about the filesystem containing the file associated with file descriptor fd.

os.fsync(fd)- Force write of file with filedescriptor fd to disk.

os.ftruncate(fd, length)- Truncate the file corresponding to file descriptor so that it is at most length bytes in size.

os.getcwd()- Return a string representing the current working directory.

os.getcwdu()- Return a Unicode object representing the current working directory.

os.isatty(fd)- Return True if the file descriptor fd is open and connected to device, else False.

os.lchflags(path, flags)- Set the flags of path to the numeric flags but do not follow symbolic links.

os.lchmod(path, mode)- Change the mode of path to the numeric mode.

os.lchown(path, uid, gid)- Change the owner and group id of path to the numeric. This function will not follow symbolic links.

os.link(src, dst)- Create a hard link pointing to src named dst.

os.listdir(path)- Return a list containing the names of the entries in the directory given by path.

os.lseek(fd, pos, how)- Set the current position of file descriptor fd to position modified.

os.lstat(path)- Like stat(), but do not follow symbolic links.

os.major(device)- Extract the device major number from a raw device number.

os.makedev(major, minor)- Compose a raw device number from the major and minor device numbers.

os.makedirs(path[, mode])- Recursive directory creation function.

os.minor(device)- Extract the device minor number from a raw device number .

os.mkdir(path[, mode])- Create a directory named path with numeric mode.

os.mkfifo(path[, mode])- Create a FIFO which is a named pipe named path with numeric mode. The default mode is octal.

os.mknod(filename[, mode, device])- Create a filesystem node that is a file, device special file or named pipe that is named filename.

os.open(file, flags[, mode])- Open the file and set various flags according to flags and possibly its mode according to mode.

os.openpty()- Open a new pseudo-terminal pair. Return a pair of file descriptors (master, slave).

os.pathconf(path, name)- Return system configuration information relevant to a named file.

os.pipe()- Create a pipe. Return a pair of file descriptors (r, w) usable for reading and writing.

os.popen(command[, mode[, bufsize]])- Open a pipe to or from command.

os.read(fd, n)- Read at most n bytes from file descriptor that would return a string containing the bytes read. If the end of the file referred to be reached so an empty string is returned.

os.readlink(path)- Return a string representing the path to which the symbolic link points.

os.remove(path)- Remove the file path.

os.removedirs(path)- Remove directories recursively.

os.rename(src, dst)- Rename the file or directory src to dst.

os.renames(old, new)- Recursive directory or file renaming function.

os.rmdir(path)- Remove the directory path

os.stat(path)- Perform a stat system call on the given path.

os.stat_float_times([newvalue])- Determine whether stat_result represents time stamps as float objects.

os.statvfs(path)- Perform a statvfs system call on the given path.

Image