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

Skip to content

Commit d6cf8be

Browse files
committed
Modify example to use string methods instead of the string module.
1 parent 4b24726 commit d6cf8be

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Doc/lib/libfuncs.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,17 @@ \section{Built-in Functions \label{built-in-funcs}}
3737
a non-empty \var{fromlist} argument is given, the module named by
3838
\var{name} is returned. This is done for compatibility with the
3939
bytecode generated for the different kinds of import statement; when
40-
using \samp{import spam.ham.eggs}, the top-level package \code{spam}
40+
using \samp{import spam.ham.eggs}, the top-level package \module{spam}
4141
must be placed in the importing namespace, but when using \samp{from
4242
spam.ham import eggs}, the \code{spam.ham} subpackage must be used
4343
to find the \code{eggs} variable. As a workaround for this
4444
behavior, use \function{getattr()} to extract the desired
4545
components. For example, you could define the following helper:
4646

4747
\begin{verbatim}
48-
import string
49-
5048
def my_import(name):
5149
mod = __import__(name)
52-
components = string.split(name, '.')
50+
components = name.split('.')
5351
for comp in components[1:]:
5452
mod = getattr(mod, comp)
5553
return mod

0 commit comments

Comments
 (0)