Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to swapcase of string 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 #swapcase #string #python
ADD COMMENT
Topic
Name
5+3 =