推荐学习书目
› 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
RicardoScofileld
V2EX  ›  Python

关于对字符串进行 strip,一个奇怪的原因

  •  
  •   RicardoScofileld · Jul 3, 2018 · 2866 views
    This topic created in 3049 days ago, the information mentioned may be changed or developed.

    就是对一条字符串进行 strip 操作,没有效果,但是用 replace 就可以生效,不知道大家有没有遇到这种情况。刚我又试了一下,貌似是 json 字符串进行 strip 就没有效果

    ofooo
    ofooo
    Jul 3, 2018
    1
    卧槽我也是。。。。为什么啊
    RicardoScofileld
    RicardoScofileld
    OP
    Jul 3, 2018
    2
    @ofooo 我特么研究半天,split,startswith 等操作都有效果,就是 strip 没有效果,按理来说 json_str 也算 str 类型的啊,我自省也是 str 类型的,但特么为什么就是没有效果啊
    samirmw
    samirmw
    Jul 3, 2018 via Android
    3
    贴字符串上来看看啊
    dengshuang
    dengshuang
    Jul 3, 2018
    4
    str(json)
    RicardoScofileld
    RicardoScofileld
    OP
    Jul 4, 2018
    5
    @ofooo strip 只能去除最边上的字符,是我理解错了
    laike9m
    laike9m
    Jul 4, 2018 via Android
    6
    给个例子?以及期望输出结果
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   680 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 703ms · UTC 20:05 · PVG 04:05 · LAX 12:05 · JFK 15:05
    ♥ Do have faith in what you're doing.