string concatenation
first= str("dimpul")
second=str("sai")
print(first + " love " + second)
print(len(second))
print(len(first))
program for special cases in string
Python String strip() Method
The strip() method removes any leading, and trailing whitespaces. Leading means at the beginning of the string, trailing means at the end. You can specify which character(s) to remove, if not, any whitespaces will be removed.
first= str("dimpul sai")
print(first.upper())
print(first.lower())
print(first.strip())
print(first.replace('d','D'))
print(first.count('i'))
Comments
Post a Comment