-->

Python String Methods






Hello guys आज हम जानेंगे string function और string method

के बारे में ।

 

String function:


len () function :

यह function string की length count करता है। len() function  string  में space को भी count करता है।


Example: 


name=`vaishnavi jalkhare'

print(len(name))


Output:




           

String method : 

string method में method और string के बीच (.) डॉट लगाकर लिखते हैं। String method निम्नलिखित है:

lower() method :  

lower() method string के सभी character को small alphabet में Change कर देता है।

Example: 

name='VAISHNAVI JALKHARE'

print(name.lower())


Output:




 

upper() method

upper method string के सभी character को Capital alphabet में change कर देता है।

      

Example: 

name='vaishnavi jalkhare'

print(name.upper())

 

Output:




title method(): 

title () method काफी useful है और title () method string के पहले character को capital alphabet Change कर  देता है और बाकी सभी character को Small alphabet में change कर देता है ।

 Example: 

name='vAIshnAvi jAlkhAre'

print(name.title())

 

Output:







count ()method:  

count() method string के character को Count करते हैं ।

Example: 

name ='Vaishnavi Jalkhare'

print(name.count('h'))

 

Output:







replace () method:  

replace () method के किसी word को दूसरे word में replace कर देता है।

Example : 

string='he is beautiful and she is good dancer'

print(string.replace('is','was'))

 

Output:






find () method: 

find method string में किसी word की position को find करता है।

Example: 

string='Ram is good boy'

print(string.find('is'))


Output:







आज का tutorial आपको कैसा लगा comments कर के बताए । python के जो भी topic complete हो चुके है उसके practice quiz हमने telegram पर डालें है आप  सभी quiz के answer जरूर दें । 
Telegram = ApnaHindiTech 


😊हमारे साथ बने रहने के लिए आपका बहुत बहुत धन्यवाद !😊

 

यह भी पढ़ें

3 comments

Post a Comment