推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
explist
V2EX  ›  Python

strip()疑问?

  •  
  •   explist · Jul 29, 2017 · 2554 views
    This topic created in 3383 days ago, the information mentioned may be changed or developed.

    print('abdpab sa'.strip('pab'))

    为什么结果是:'dpab s'

    3 replies  •  2017-08-09 21:30:21 +08:00
    virusdefender
    virusdefender
    Jul 29, 2017❤️3
    1
    Return a copy of the string with leading and trailing characters removed. If chars is omitted or None, whitespace characters are removed. If given and not None, chars must be a string; the characters in the string will be stripped from the both ends of the string this method is called on.

    好好理解最后一句
    explist
    explist
    OP
    Jul 29, 2017
    2
    原来如此,谢谢
    symons
    symons
    Aug 9, 2017
    3
    1 Docstring for builtins:function strip
    2 ========================================
    3 S.strip([chars]) -> str
    4
    5 Return a copy of the string S with leading and trailing
    6 whitespace removed.
    7 If chars is given and not None, remove characters in chars instead.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5421 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 02:51 · PVG 10:51 · LAX 18:51 · JFK 21:51
    ♥ Do have faith in what you're doing.