gadss gadss - 1 year ago 96
Python Question

How to change a string into uppercase

I have problem in changing a string into uppercase with Python. In my research, I got

but it doesn't work.

The following code:

>>s = 'sdsd'

Gives this error message:

Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'str' object has no attribute 'ascii_uppercase'

My question is: how can I convert a string into uppercase in Python?

Answer Source
>>> s = 'sdsd'
>>> s.upper()

See String Methods.