Kaydet (Commit) ab3a2504 authored tarafından Guido van Rossum's avatar Guido van Rossum

libsocket.tex: send[to] returns nbytes.

libstring.tex: added count().
ref2.tex: new keywords; moved keyword printing program to keywords.py.
üst 7f43da7d
#! /usr/local/bin/python
# This Python program sorts and reformats the table of keywords in ref2.tex
import string
l = []
try:
while 1:
l = l + string.split(raw_input())
except EOFError:
pass
l.sort()
for x in l[:]:
while l.count(x) > 1: l.remove(x)
ncols = 5
nrows = (len(l)+ncols-1)/ncols
for i in range(nrows):
for j in range(i, len(l), nrows):
print string.ljust(l[j], 10),
print
...@@ -193,13 +193,13 @@ socket sending the data. ...@@ -193,13 +193,13 @@ socket sending the data.
\begin{funcdesc}{send}{string} \begin{funcdesc}{send}{string}
Send data to the socket. The socket must be connected to a remote Send data to the socket. The socket must be connected to a remote
socket. socket. Return the number of bytes sent.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sendto}{string\, address} \begin{funcdesc}{sendto}{string\, address}
Send data to the socket. The socket should not be connected to a Send data to the socket. The socket should not be connected to a
remote socket, since the destination socket is specified by remote socket, since the destination socket is specified by
\code{address}. \code{address}. Return the number of bytes sent.
(The format of \var{address} depends on the address family -- see above.) (The format of \var{address} depends on the address family -- see above.)
\end{funcdesc} \end{funcdesc}
......
...@@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is ...@@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is
not found. not found.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{count}{s\, sub\, i}
Return the number of (non-overlapping) occurrences of substring
\var{sub} in string \var{s} with index at least \var{i}.
If \var{i} is omitted, it defaults to \code{0}.
\end{funcdesc}
\begin{funcdesc}{lower}{s} \begin{funcdesc}{lower}{s}
Convert letters to lower case. Convert letters to lower case.
\end{funcdesc} \end{funcdesc}
......
...@@ -193,13 +193,13 @@ socket sending the data. ...@@ -193,13 +193,13 @@ socket sending the data.
\begin{funcdesc}{send}{string} \begin{funcdesc}{send}{string}
Send data to the socket. The socket must be connected to a remote Send data to the socket. The socket must be connected to a remote
socket. socket. Return the number of bytes sent.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sendto}{string\, address} \begin{funcdesc}{sendto}{string\, address}
Send data to the socket. The socket should not be connected to a Send data to the socket. The socket should not be connected to a
remote socket, since the destination socket is specified by remote socket, since the destination socket is specified by
\code{address}. \code{address}. Return the number of bytes sent.
(The format of \var{address} depends on the address family -- see above.) (The format of \var{address} depends on the address family -- see above.)
\end{funcdesc} \end{funcdesc}
......
...@@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is ...@@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is
not found. not found.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{count}{s\, sub\, i}
Return the number of (non-overlapping) occurrences of substring
\var{sub} in string \var{s} with index at least \var{i}.
If \var{i} is omitted, it defaults to \code{0}.
\end{funcdesc}
\begin{funcdesc}{lower}{s} \begin{funcdesc}{lower}{s}
Convert letters to lower case. Convert letters to lower case.
\end{funcdesc} \end{funcdesc}
......
#! /usr/local/bin/python
# This Python program sorts and reformats the table of keywords in ref2.tex
import string
l = []
try:
while 1:
l = l + string.split(raw_input())
except EOFError:
pass
l.sort()
for x in l[:]:
while l.count(x) > 1: l.remove(x)
ncols = 5
nrows = (len(l)+ncols-1)/ncols
for i in range(nrows):
for j in range(i, len(l), nrows):
print string.ljust(l[j], 10),
print
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment