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
d003a2a5
Kaydet (Commit)
d003a2a5
authored
Haz 26, 2002
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Describe textwrap module
üst
ca0383d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+35
-2
No files found.
Doc/whatsnew/whatsnew23.tex
Dosyayı görüntüle @
d003a2a5
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
%
%
% getopt.gnu_getopt
% getopt.gnu_getopt
%
%
% textwrap.py
%
% Docstrings now optional (with --without-doc-strings)
% Docstrings now optional (with --without-doc-strings)
%
%
% New dependency argument to distutils.Extension
% New dependency argument to distutils.Extension
...
@@ -468,6 +466,41 @@ in the source tree, or the CVS logs, for a more complete list.
...
@@ -468,6 +466,41 @@ in the source tree, or the CVS logs, for a more complete list.
\begin{itemize}
\begin{itemize}
\item
The
\module
{
textwrap
}
module contains functions for wrapping
strings containing paragraphs of text. The
\function
{
wrap(
\var
{
text
}
,
\var
{
width
}
)
}
function takes a string and returns a list containing
the text split into lines of no more than the chosen width. The
\function
{
fill(
\var
{
text
}
,
\var
{
width
}
)
}
function returns a single
string, reformatted to fit into lines no longer than the chosen width.
(As you can guess,
\function
{
fill()
}
is built on top of
\function
{
wrap()
}
. For example:
\begin{verbatim}
>>> import textwrap
>>> paragraph = "Not a whit, we defy augury: ... more text ..."
>>> textwrap.wrap(paragraph, 60)
["Not a whit, we defy augury: there's a special providence in",
"the fall of a sparrow. If it be now, 'tis not to come; if it",
...]
>>> print textwrap.fill(paragraph, 35)
Not a whit, we defy augury: there's
a special providence in the fall of
a sparrow. If it be now, 'tis not
to come; if it be not to come, it
will be now; if it be not now, yet
it will come: the readiness is all.
>>>
\end{verbatim}
The module also contains a
\class
{
TextWrapper
}
class that actually
implements the text wrapping strategy. Both the
\class
{
TextWrapper
}
class and the
\function
{
wrap()
}
and
\function
{
fill()
}
functions support a number of additional keyword
arguments for fine-tuning the formatting; consult the module's
documentation for details.
% XXX add a link to the module docs?
(Contributed by Greg Ward.)
\item
One minor but far-reaching change is that the names of extension
\item
One minor but far-reaching change is that the names of extension
types defined by the modules included with Python now contain the
types defined by the modules included with Python now contain the
module and a
\samp
{
.
}
in front of the type name. For example, in
module and a
\samp
{
.
}
in front of the type name. For example, in
...
...
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