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

Python3 的''' '''字符串如何保证在 IDE 里对齐,写到文件里又能不带空格?

  •  
  •   fourstring · Feb 5, 2016 · 3665 views
    This topic created in 3902 days ago, the information mentioned may be changed or developed.

    如题。。。
    可能题目不太清除,我放张图就明白了

    IDE 是 pycharm ,由于强迫症,这样看起来真不舒服。。。

    9 replies  •  2016-02-06 15:05:10 +08:00
    SErHo
        1
    SErHo  
       Feb 5, 2016 via iPad   ❤️ 2
    强迫症的话处理一下啰 https://docs.python.org/3/library/textwrap.html textwrap.dedent(text)
    hcwhan
        2
    hcwhan  
       Feb 5, 2016
    \n
    fourstring
        3
    fourstring  
    OP
       Feb 5, 2016
    @SErHo 感谢!
    pynix
        4
    pynix  
       Feb 5, 2016   ❤️ 1
    Ruby 自带光环
    RqPS6rhmP3Nyn3Tm
        5
    RqPS6rhmP3Nyn3Tm  
       Feb 5, 2016 via iPad
    Command option L
    glasslion
        6
    glasslion  
       Feb 6, 2016
    text= ("Line1\n"
    "Line2\n"
    "Line3\n")
    fourstring
        7
    fourstring  
    OP
       Feb 6, 2016
    @glasslion 不用带+么?
    glasslion
        8
    glasslion  
       Feb 6, 2016   ❤️ 1
    @fourstring 不用, Python 会自动拼接两个相邻的字符串
    fourstring
        9
    fourstring  
    OP
       Feb 6, 2016
    @glasslion 谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3588 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 10:48 · PVG 18:48 · LAX 03:48 · JFK 06:48
    ♥ Do have faith in what you're doing.