Python3 os.chown () method
Outline
os.chown () method is used to change the owner of the file, if you can not modify the set to -1, you need superuser privileges to execute permissions to modify operations.
Supports only be used under Unix.
grammar
chown () method of the following syntax: os.chown (path, uid, gid );
parameter
-
path - the path to set permissions for the file that you want to change [this document] where
-
uid - their user ID you want to change [to whom]
-
gid - User Group [ID that you want to change to a group]
Python3 os.dup2 () method
Outline
os.dup2 () method is used to copy a file descriptor fd to another fd2. Unix, available on Windows.
grammar
dup2 () method of the following syntax: os.dup2 (fd, fd2);
parameter
-
fd - the file descriptor to be copied
-
FD2 - Copy the file descriptor
OS Import # open a file F = Open ( 'TXT', 'A') # file represented by file descriptor, a file descriptor is transmitted to points (i.e. stdout) os.dup2 (f.fileno () , 1) # close the file f.close () # Print output to the standard output stream, the file descriptor is a Print ( 'runoob') Print ( 'Google')
The feeling is supposed to be output to the output to a file on the screen