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

Python 的 django 中出现的|slice:'10',什么意思啊??

  •  
  •   happykjoy · Jul 14, 2019 · 2993 views
    This topic created in 2632 days ago, the information mentioned may be changed or developed.
    django 的 view.py 文件中
    fruit2 = GoodsInfo.objects.filter(gtype__id=2).order_by("-gclick")[:3]
    网页文件中
    <a href="/{{g.id}}">{{g.gtitle|slice:'10'}}...</a>
    这个{{g.gtitle|slice:'10'}}什么意思??怎么网上没看到|slice:'10'这样用法??
    2 replies  •  2019-07-14 17:54:32 +08:00
    happykjoy
        2
    happykjoy  
    OP
       Jul 14, 2019
    Thanks! @SingeeKing
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5006 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:23 · PVG 09:23 · LAX 18:23 · JFK 21:23
    ♥ Do have faith in what you're doing.