These functions and data items provide information and operate on the current process and user.
environ['HOME']
is the pathname of your home directory (on some
platforms), and is equivalent to getenv("HOME")
in C.
If the platform supports the putenv() function, this
mapping may be used to modify the environment as well as query the
environment. putenv() will be called automatically when
the mapping is modified. Note:
On some platforms, including
FreeBSD and Mac OS X, setting environ
may cause memory leaks.
Refer to the system documentation for putenv.
If putenv() is not provided, this mapping may be passed to the appropriate process-creation functions to cause child processes to use a modified environment.
None
.
Availability: most flavors of Unix, Windows.
Note:
On some platforms, including FreeBSD and Mac OS X,
setting environ
may cause memory leaks.
Refer to the system documentation for putenv.
When putenv() is
supported, assignments to items in os.environ
are automatically
translated into corresponding calls to putenv(); however,
calls to putenv() don't update os.environ
, so it is
actually preferable to assign to items of os.environ
.
(sysname, nodename, release, version,
machine)
. Some systems truncate the nodename to 8
characters or to the leading component; a better way to get the
hostname is socket.gethostname()
or even
socket.gethostbyaddr(socket.gethostname())
.
Availability: recent flavors of Unix.
See About this document... for information on suggesting changes.