Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a7e25f

Browse files
committed
#444582: fix example and rewrap docs a bit.
1 parent 4168764 commit 4a7e25f

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

Doc/library/shutil.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,31 +268,32 @@ Directory and files operations
268268

269269
.. versionadded:: 3.3
270270

271+
271272
.. function:: which(cmd, mode=os.F_OK | os.X_OK, path=None)
272273

273-
Return the path to an executable which would be run if the given *cmd*
274-
was called. If no *cmd* would be called, return ``None``.
274+
Return the path to an executable which would be run if the given *cmd* was
275+
called. If no *cmd* would be called, return ``None``.
275276

276277
*mode* is a permission mask passed a to :func:`os.access`, by default
277278
determining if the file exists and executable.
278279

279-
When no *path* is specified, the results of :func:`os.environ` are
280-
used, returning either the "PATH" value or a fallback of :attr:`os.defpath`.
280+
When no *path* is specified, the results of :func:`os.environ` are used,
281+
returning either the "PATH" value or a fallback of :attr:`os.defpath`.
281282

282-
On Windows, the current directory is always prepended to the *path*
283-
whether or not you use the default or provide your own, which
284-
is the behavior the command shell uses when finding executables.
285-
Additionaly, when finding the *cmd* in the *path*, the
286-
``PATHEXT`` environment variable is checked. For example, if you
287-
call ``shutil.which("python")``, :func:`which` will search
288-
``PATHEXT`` to know that it should look for ``python.exe`` within
289-
the *path* directories.
283+
On Windows, the current directory is always prepended to the *path* whether
284+
or not you use the default or provide your own, which is the behavior the
285+
command shell uses when finding executables. Additionaly, when finding the
286+
*cmd* in the *path*, the ``PATHEXT`` environment variable is checked. For
287+
example, if you call ``shutil.which("python")``, :func:`which` will search
288+
``PATHEXT`` to know that it should look for ``python.exe`` within the *path*
289+
directories. For example, on Windows::
290290

291-
>>> print(shutil.which("python"))
291+
>>> shutil.which("python")
292292
'c:\\python33\\python.exe'
293293

294294
.. versionadded:: 3.3
295295

296+
296297
.. exception:: Error
297298

298299
This exception collects exceptions that are raised during a multi-file

0 commit comments

Comments
 (0)