推荐学习书目
› 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 · 3728 views
    This topic created in 3933 days ago, the information mentioned may be changed or developed.

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

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

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