Last Updated on June 17, 2021 by Roshan Parihar
In this tutorial, learn how to change string to uppercase in Python. The short answer is: use the Python upper()
function to convert a string to an uppercase character. Make each letter of a string to uppercase and create a new string with all characters in uppercase.
The uppercase makes all the letters in a capital case format. Somewhere in your programming, you may want to get uppercase letters in the output. Python provides a simple function to convert each character to uppercase.
How to Change String to Uppercase Characters Using Python
If you want to convert each and every character of the string to capital. You have to use the Python function upper()
which makes all letters uppercase. You may also like to learn how to convert all strings to lowercase in Python.
1 2 |
mylStr = "What are you doing here?"; print(mylStr.upper()); |
Output
The above example showing the output with all the letters in uppercase. However, if you have all the letters in uppercase.
You can also want to convert the first letter of each word to uppercase. It is the camel case method where you have to make the start letter of each word capitalized. Python does not provide any other functions to convert the letters of each word to the capital letter.
DOWNLOAD Free PYTHON CHEAT SHEET
You may also like to read
- How to create a string variable in Python
- Access string character by index using Python
- Combine two string variables in Python
I hope you like this post on how to change string to uppercase characters using python.
References