String functions deprication
Paul Watson
pwatson at redlinepy.com
Tue Aug 16 16:26:29 EDT 2005
steve morin wrote:
> http://www.python.org/doc/2.4.1/lib/node110.html
>
> These methods are being deprecated. What are they being replaced
> with? Does anyone know?
>
> Steve
It might be helpful to compare the following lists.
Python 2.1 (#1, May 23 2003, 11:43:56) [C] on aix4
Type "copyright", "credits" or "license" for more information.
>>> import string
>>> dir(string)
['_StringType', '__builtins__', '__doc__', '__file__', '__name__',
'_float', '_idmap', '_idmapL', '_int', '_long', 'atof', 'atof_error',
'atoi', 'atoi_error', 'atol', 'atol_error', 'capitalize', 'capwords',
'center', 'count', 'digits', 'expandtabs', 'find', 'hexdigits', 'index',
'index_error', 'join', 'joinfields', 'letters', 'ljust', 'lower',
'lowercase', 'lstrip', 'maketrans', 'octdigits', 'printable',
'punctuation', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split',
'splitfields', 'strip', 'swapcase', 'translate', 'upper', 'uppercase',
'whitespace', 'zfill']
>>> s = "now"
>>> dir(s)
['capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs',
'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace',
'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace',
'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines',
'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper']
>>> for m in dir(string):
... if m not in dir(s):
... print m
...
_StringType
__builtins__
__doc__
__file__
__name__
_float
_idmap
_idmapL
_int
_long
atof
atof_error
atoi
atoi_error
atol
atol_error
capwords
digits
hexdigits
index_error
joinfields
letters
lowercase
maketrans
octdigits
printable
punctuation
splitfields
uppercase
whitespace
zfill
>>> for m in dir(s):
... if m not in dir(string):
... print m
...
encode
endswith
isalnum
isalpha
isdigit
islower
isspace
istitle
isupper
splitlines
startswith
title
More information about the Python-list
mailing list