Deprecated Functions in Python"s String Module

106 5


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])
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.