python str.strip strange behavior

Posted by Tzury Bar Yochay on Stack Overflow See other posts from Stack Overflow or by Tzury Bar Yochay
Published on 2010-06-07T15:50:05Z Indexed on 2010/06/07 16:42 UTC
Read the original article Hit count: 191

>>> t1 = "abcd.org.gz"
>>> t1
'abcd.org.gz'
>>> t1.strip("g")
'abcd.org.gz'
>>> t1.strip("gz")
'abcd.org.'
>>> t1.strip(".gz")
'abcd.or'

Why does the 'g' of '.org' is gone?

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner