Python String Methods
Hello guys आज हम जानेंगे string
function और string method
के बारे में ।
String function:
len () function :
Example:
name=`vaishnavi jalkhare'
print(len(name))
String method :
lower() method :
lower() method string के सभी character को small alphabet में Change कर देता है।
Example:
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'))
replace () method:
replace () method के किसी word को दूसरे word में replace कर देता है।
Example :
string='he is beautiful and she is good dancer'
find () method:
find method string में किसी word की position को find करता है।
Example:
string='Ram is good boy'
print(string.find('is'))
Output:
😊हमारे साथ बने रहने के लिए आपका बहुत बहुत धन्यवाद !😊
यह भी पढ़ें
3 comments
Python is super power full language
ReplyDeleteGreat language
ReplyDeletePython is best source of income
ReplyDelete