Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

Hello, all. In python, I don't know how to convert a string into an uppercase. I thought string.ascii_uppercase will work, but it doesn't.

Look at the following code:

>>s = 'sdsd'

 >>s.ascii_uppercase

Ultimately, it gives a error message:

Traceback (most recent call last):

  File "<console>", line 1, in <module>

AttributeError: 'str' object has no attribute 'ascii_uppercase'

Anyone, please help me, guys.

1 Answer

0 votes
by (26.4k points)

Try the following code:

>>> s = 'sdsd'

>>> s.upper()

'SDSD'

Have a look at the documentation of String method.

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Related questions

0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
+1 vote
2 answers

Browse Categories

...