mardi 2 août 2016

Removing specific matching substring from a string python

I want to remove a matching substring from a string in python .

Here is what I have tried so far:

abc= "20160622125255102D87Z2"

if "Z2" in abc:
    abc.rstrip("Z2")
    print(abc)

But this doesn't work. Kindly help

Aucun commentaire:

Enregistrer un commentaire