WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Python string


String Special Operators

Operater Description
+ Concatenation - Adds values of the operator
* concatenating multiple copies of the same string
[] Slice Character from very given index
[ : ] character from the given range
% for seeing next section

Escape charaters

Operater Description
\b backspace
\e escape
\f formfeed
\r Carriage return
\s space
\v vertical tab

Example

#first example

Find the character of position 1

b = "Phython"

print(b[1])
Result Answer: h
#second example

Find the character of 1 to 3

b= "Phython"
 
print(b[1:3])
Result Answer: hyt
#third example

lower () method returns the string in lower case:

a = "Good, Bye!"
print(a.lower())

Result Answer: good bye
#four example

The upper() method returns the string in upper case:

a = "Good, Bye!"
print(a.upper())


Result Answer : GOOD BYE!
#five example

The replace() method replaces a string with another string:


a = "Hello, Mopez!"
print(a.replace("J", "L"))

Result Answer : Jello Lopez