programplug Logo




Python String Methods


Concatenation

"Ram"+"Kumar"

Output:
"RamKumar"


Replication

2*"Rahul"

Output:
"RahulRahul"


Slice

str="Rahul" 
str[2:5]  

Output:
hu


capitalize()

"rahul".capitalize()   

Output:
Rahul


count()

name = "Hello How Are You?"
substring = "Are"
count = name.count(substring)
print("The count is:", count)  

Output:
The count is: 2


endswith()

name="Welcome to Python";
substring="Python";    
print name.endswith(substring);      

Output:
True


find()

str="Welcome to Python";  
substr1="to";  
substr2="Python";  
print str.find(substr1);  
print str.find(substr2);       

Output:
8
11







Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
0000000000

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy