big letter -> small letter

V

vertigo

Hello
How can i change big letter to small letter ?

When i tried char=char+32 i received error that can not add int to sring.

Thanx
Michal
 
R

Reinhold Birkenfeld

vertigo said:
Hello
How can i change big letter to small letter ?

When i tried char=char+32 i received error that can not add int to sring.

That's C thinking, you have to get away from that ;)

In Python, there is no "char" type. Every char is a string, and you
can't add an integer to a string.

But, luckily, everything is an object, too, and has useful methods to do
something with the object. In case of your problem, that would be

char = char.lower()

Reinhold
 
I

Irmen de Jong

vertigo said:
Hello
How can i change big letter to small letter ?

When i tried char=char+32 i received error that can not add int to sring.

Which is ofcourse, correct behavior. You cannot add numbers to strings.

Use the tolower string method. It even works on strings of length >1:
bigletter

There's also an upper().

--Irmen
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top