strip() & replace() method [Solve problem with spaces:Python tutorial 21

Publié le: 25 février 2019
sur la chaîne: Divya Bharati
42
3

This video covers #strip()_method & #replace_method. It is used to solve problem with spaces.Must watch previous videos to make it more clear.Source codes are given below:

name=" Divya "
dots="......."

print(name+dots)
Divya .......

----#lstrip()-left spaces-----

print(name.lstrip()+dots)
Divya .......

--------#rstrip()-right--------

print(name.rstrip()+dots)
Divya.......

----------#strip() method---------
print(name.strip()+dots)
Divya.......


name="di vya"
print(name.strip()+dots)
di vya.......
#replace() method

---------------name.replace(" ","")----------

print(name.replace(" ",""))
divya
print(name.replace(" ","*"))
di***vya
print(name.replace(" ","")+dots)
divya.......
name,char=input("Enter your name & a single character\n").split(",")
Enter your name & a single character
Isha Sinha, i

print(f"Character count = {name.strip().lower().count(char.strip().lower())}")
Character count = 2

Must watch the video & read the codes carefully

Thank you...!!!


Sur cette page du site, vous pouvez voir la vidéo en ligne strip() & replace() method [Solve problem with spaces:Python tutorial 21 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Divya Bharati 25 février 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 42 fois et il a aimé 3 téléspectateurs. Bon visionnage!