By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

Why is lower() deprecated and how should I replace it?

P: n/a
I read that lower() is deprecated. Unfortunately, I
can't find the preferred way of lowercasing a string.
What is it?

Thanks

PS Please cc me on all responses.

__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gf gf wrote:
I read that lower() is deprecated. Unfortunately, I
can't find the preferred way of lowercasing a string.
What is it?


Instead of string.lower(s), use s.lower()

Jul 18 '05 #2

P: n/a
gf gf wrote:
I read that lower() is deprecated.


Most of the functions in the string module are deprecated, yes. They
have been replaced by string methods on the string objects themselves.
These methods are *not* deprecated.
In [1]: s = 'I aM a hApPY lITtLe STRing thAt WAnTS to Be loWEr CaSE.'

In [2]: s.lower()
Out[2]: 'i am a happy little string that wants to be lower case.'

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.