V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
ciba1990
V2EX  ›  Python

python 截取字符串固定长度怎么实现

  •  
  •   ciba1990 · 2015-07-31 11:47:56 +08:00 · 4263 次点击
    这是一个创建于 3194 天前的主题,其中的信息可能已经有所发展或是发生改变。

    例如截取字符串的前20个字节

    2a
        1
    2a  
       2015-07-31 11:55:17 +08:00   ❤️ 1
    scream7
        2
    scream7  
       2015-07-31 11:57:54 +08:00   ❤️ 1
    s[:20] ???
    xbonline
        3
    xbonline  
       2015-07-31 12:01:53 +08:00   ❤️ 1
    这类问题为啥不RTFM?
    tinyproxy
        4
    tinyproxy  
       2015-08-01 02:04:21 +08:00   ❤️ 1
    连教程都不看完我也是醉了。。。
    leavic
        5
    leavic  
       2015-08-01 20:49:48 +08:00 via iPhone   ❤️ 1
    你真的学过python吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5437 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 08:46 · PVG 16:46 · LAX 01:46 · JFK 04:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.