Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c3ef037e
Kaydet (Commit)
c3ef037e
authored
Şub 20, 2012
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add missing “::” markup.
Also wrap two looong lines.
üst
0467686e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
argparse.rst
Doc/library/argparse.rst
+16
-15
No files found.
Doc/library/argparse.rst
Dosyayı görüntüle @
c3ef037e
...
@@ -720,7 +720,7 @@ how the command-line arguments should be handled. The supported actions are:
...
@@ -720,7 +720,7 @@ how the command-line arguments should be handled. The supported actions are:
* ``'version'`` - This expects a ``version=`` keyword argument in the
* ``'version'`` - This expects a ``version=`` keyword argument in the
:meth:`~ArgumentParser.add_argument` call, and prints version information
:meth:`~ArgumentParser.add_argument` call, and prints version information
and exits when invoked
.
and exits when invoked
::
>>> import argparse
>>> import argparse
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser = argparse.ArgumentParser(prog='PROG')
...
@@ -772,8 +772,8 @@ single action to be taken. The ``nargs`` keyword argument associates a
...
@@ -772,8 +772,8 @@ single action to be taken. The ``nargs`` keyword argument associates a
different number of command-line arguments with a single action. The supported
different number of command-line arguments with a single action. The supported
values are:
values are:
* ``N`` (an integer). ``N`` arguments from the command line will be gathered
together into a
* ``N`` (an integer). ``N`` arguments from the command line will be gathered
list. For example::
together into a
list. For example::
>>> parser = argparse.ArgumentParser()
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', nargs=2)
>>> parser.add_argument('--foo', nargs=2)
...
@@ -842,7 +842,7 @@ values are:
...
@@ -842,7 +842,7 @@ values are:
* ``argparse.REMAINDER``. All the remaining command-line arguments are gathered
* ``argparse.REMAINDER``. All the remaining command-line arguments are gathered
into a list. This is commonly useful for command line utilities that dispatch
into a list. This is commonly useful for command line utilities that dispatch
to other command line utilities
.
to other command line utilities
::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--foo')
>>> parser.add_argument('--foo')
...
@@ -865,7 +865,8 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
...
@@ -865,7 +865,8 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
* When :meth:`~ArgumentParser.add_argument` is called with
* When :meth:`~ArgumentParser.add_argument` is called with
``action='store_const'`` or ``action='append_const'``. These actions add the
``action='store_const'`` or ``action='append_const'``. These actions add the
``const`` value to one of the attributes of the object returned by :meth:`~ArgumentParser.parse_args`. See the action_ description for examples.
``const`` value to one of the attributes of the object returned by
:meth:`~ArgumentParser.parse_args`. See the action_ description for examples.
* When :meth:`~ArgumentParser.add_argument` is called with option strings
* When :meth:`~ArgumentParser.add_argument` is called with option strings
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
...
@@ -1576,21 +1577,21 @@ FileType objects
...
@@ -1576,21 +1577,21 @@ FileType objects
The :class:`FileType` factory creates objects that can be passed to the type
The :class:`FileType` factory creates objects that can be passed to the type
argument of :meth:`ArgumentParser.add_argument`. Arguments that have
argument of :meth:`ArgumentParser.add_argument`. Arguments that have
:class:`FileType` objects as their type will open command-line arguments as files
:class:`FileType` objects as their type will open command-line arguments as files
with the requested modes and buffer sizes:
with the requested modes and buffer sizes:
:
>>> parser = argparse.ArgumentParser()
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--output', type=argparse.FileType('wb', 0))
>>> parser.add_argument('--output', type=argparse.FileType('wb', 0))
>>> parser.parse_args(['--output', 'out'])
>>> parser.parse_args(['--output', 'out'])
Namespace(output=<_io.BufferedWriter name='out'>)
Namespace(output=<_io.BufferedWriter name='out'>)
FileType objects understand the pseudo-argument ``'-'`` and automatically
FileType objects understand the pseudo-argument ``'-'`` and automatically
convert this into ``sys.stdin`` for readable :class:`FileType` objects and
convert this into ``sys.stdin`` for readable :class:`FileType` objects and
``sys.stdout`` for writable :class:`FileType` objects:
``sys.stdout`` for writable :class:`FileType` objects:
:
>>> parser = argparse.ArgumentParser()
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('infile', type=argparse.FileType('r'))
>>> parser.add_argument('infile', type=argparse.FileType('r'))
>>> parser.parse_args(['-'])
>>> parser.parse_args(['-'])
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)
Argument groups
Argument groups
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment