Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to convert string to uppercase, lowercase and how to swapcase in python

s = 'KDnuggets'

print(''KDnuggets' as uppercase: {}'.format(s.upper()))
print(''KDnuggets' as lowercase: {}'.format(s.lower()))
print(''KDnuggets' as swapped case: {}'.format(s.swapcase()))


# Output

# 'KDnuggets' as uppercase: KDNUGGETS
# 'KDnuggets' as lowercase: kdnuggets
# 'KDnuggets' as swapped case: kdNUGGETS
Source by www.kdnuggets.com #
 
PREVIOUS NEXT
Tagged: #How #convert #string #lowercase #swapcase #python
ADD COMMENT
Topic
Name
2+5 =