str.strip() strange behavior

前端 未结 5 698
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 08:25
>>> t1 = "abcd.org.gz"
>>> t1
\'abcd.org.gz\'
>>> t1.strip("g")
\'abcd.org.gz\'
>>> t1.strip("gz")
         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 09:05

    strip(".gz") removes any of the characters ., g and z from the beginning and end of the string.

提交回复
热议问题