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
b9c3ed4f
Kaydet (Commit)
b9c3ed4f
authored
Ock 04, 2010
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#3340: document print/get_usage and print/get_version
üst
2bcd1772
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
optparse.rst
Doc/library/optparse.rst
+26
-0
No files found.
Doc/library/optparse.rst
Dosyayı görüntüle @
b9c3ed4f
...
...
@@ -603,6 +603,20 @@ For example, if your script is called ``/usr/bin/foo``::
$ /usr/bin/foo --version
foo 1.0
The following two methods can be used to print and get the ``version`` string:
.. method:: OptionParser.print_version(file=None)
Print the version message for the current program (``self.version``) to
*file* (default stdout). As with :meth:`print_usage`, any occurrence
of ``"%prog"`` in ``self.version`` is replaced with the name of the current
program. Does nothing if ``self.version`` is empty or undefined.
.. method:: OptionParser.get_version()
Same as :meth:`print_version` but returns the version string instead of
printing it.
.. _optparse-how-optparse-handles-errors:
...
...
@@ -1389,6 +1403,18 @@ OptionParser supports several other public methods:
constructor keyword argument. Passing ``None`` sets the default usage
string; use :data:`optparse.SUPPRESS_USAGE` to suppress a usage message.
.. method:: OptionParser.print_usage(file=None)
Print the usage message for the current program (``self.usage``) to *file*
(default stdout). Any occurrence of the string ``"%prog"`` in ``self.usage``
is replaced with the name of the current program. Does nothing if
``self.usage`` is empty or not defined.
.. method:: OptionParser.get_usage()
Same as :meth:`print_usage` but returns the usage string instead of
printing it.
.. method:: OptionParser.set_defaults(dest=value, ...)
Set default values for several option destinations at once. Using
...
...
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