Python String upper() Method
The Python upper() method is used to return a string where all characters are in upper case. It returns a new string with the upper cased version of the original string.
For example:
text = "Hello my friends"
result = text.upper()
print(result)
# Output: HELLO MY FRIENDS
You can also use upper() on a string that contains numbers or symbols. The upper() method ignores them and only converts the alphabetic characters to upper case.
For example:
text = "heLLo wORld 123 !@#"
result = text.upper()
print(result)
# Output: HELLO WORLD 123 !@#
If you have any questions about this code, you can drop a line in comment.
Comments
Post a Comment