uppercase

How to change a string into uppercase

How to change a string into uppercase? Question: I have problem in changing a string into uppercase with Python. In my research, I got string.ascii_uppercase but it doesn’t work. The following code: >>s = ‘sdsd’ >>s.ascii_uppercase Gives this error message: Traceback (most recent call last): File “<console>”, line 1, in <module> AttributeError: ‘str’ object has …

Total answers: 8

Python title() with apostrophes

Python title() with apostrophes Question: Is there a way to use .title() to get the correct output from a title with apostrophes? For example: “john’s school”.title() –> “John’S School” How would I get the correct title here, “John’s School” ? Asked By: David542 || Source Answers: If your titles do not contain several whitespace characters …

Total answers: 6

How do I lowercase a string in Python?

How do I lowercase a string in Python? Question: Is there a way to convert a string to lowercase? "Kilometers" → "kilometers" See How to change a string into uppercase? for the opposite. Asked By: Benjamin Didur || Source Answers: Use str.lower(): "Kilometer".lower() Answered By: Petar Ivanov Also, you can overwrite some variables: s = …

Total answers: 9

How can I convert Unicode to uppercase to print it?

How can I convert Unicode to uppercase to print it? Question: I have this: >>> print ‘example’ example >>> print ‘exámple’ exámple >>> print ‘exámple’.upper() EXáMPLE What I need to do to print: EXÁMPLE (Where the ‘a’ gets its accute accent, but in uppercase.) I’m using Python 2.6. Asked By: Alex. S. || Source Answers: …

Total answers: 5