1. Home
  2. Computing & Technology
  3. Python

Deprecated Functions in Python's String Module

by Al Lukaszewski
for About.com

The following functions have been deprecated as of Python 2.5. Each has been replaced by its counterpart among the built-in string methods. If you use them in code, you should not be surprised to get a deprecation warning. These functions will not be removed from Python until version 3.0. You therefore have until that release to update your codebase.

In the following references, s indicates the string to be modified. For the other arguments, see the corresponding built-in string method.

  • atof(s): Deprecated since Python 2.0. Use the float() built-in function.
  • atoi(s[, base]): Deprecated since Python 2.0. Use the int() built-in function.
  • atol(s[, base]): Deprecated since Python 2.0. Use the long() built-in function.
  • capitalize(word)
  • expandtabs(s[, tabsize])
  • find(s, sub[, start[,end]])
  • rfind(s, sub[, start[, end]])
  • index(s, sub[, start[, end]])
  • rindex(s, sub[, start[, end]])
  • count(s, sub[, start[, end]])
  • lower(s)
  • split(s[, sep[, maxsplit]])
  • rsplit(s[, sep[, maxsplit]])
  • splitfields(s[, sep[, maxsplit]])
  • join(words[, sep])
  • joinfields(words[, sep])
  • lstrip(s[, chars])
  • rstrip(s[, chars])
  • strip(s[, chars])
  • swapcase(s)
  • translate(s, table[, deletechars])
  • upper(s)
  • ljust(s, width)
  • rjust(s, width)
  • center(s, width)
  • zfill(s, width)
  • replace(str, old, new[, maxreplace])
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >