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

Pubblicato il: 25 febbraio 2019
sul canale di: 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...!!!


In questa pagina del sito puoi guardare il video online strip() & replace() method [Solve problem with spaces:Python tutorial 21 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Divya Bharati 25 febbraio 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 42 volte e gli è piaciuto 3 spettatori. Buona visione!