© 2004-21

Change the Case of a String

Python has a range of methods to change the case of text strings.
Check out the snippets below to find the one that is most suitable for you

		# A Knifton
# Demo of Python string methods
myText = "On June 27th, YouTuber Fapplet uploaded a montage parody video"
print("Original Text:{}".format(myText))
# Changing to uppercase:
print("Changed to upper case:{} ".format(myText.upper()))
# Changing to lowercase:
print(" Changed to lower case:{}".format(myText.lower()))

# Changing to First captials:
print("Changed to first letter capitalised:{} ".format(myText.capitalize()))

# Changing to title case:
print(" Changed to each word capitalised:{}".format(myText.title()))