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

G

gf gf

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/
 
D

Dan Bishop

gf said:
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()
 
R

Robert Kern

gf said:
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
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top