Python string | swapcase()
The string swapcase() method converts all uppercase characters to
lowercase and vice versa of the given string, and returns it.
Here string_name is the string whose cases are to be swapped.
Parameter: The swapcase() method does not takes any parameter.
import re
regex = re.compile('[^a-zA-Z]')
#First parameter is the replacement, second parameter is your input string
regex.sub('', 'ab3d*E')
#Out: 'abdE'
# Python program to demonstrate working
# of map.
# Return double of n
def addition(n):
return n + n
# We double all numbers using map()
numbers = (1, 2, 3, 4)
result = map(addition, numbers)
print(list(result))