V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
hellogitooxx
V2EX  ›  Python

求教,我有一组字典数据,想得到: data 里的数每三个一组,把后面的 f,z,l,t 列按竖输出。

  •  
  •   hellogitooxx · Apr 26, 2021 · 2004 views
    This topic created in 1831 days ago, the information mentioned may be changed or developed.

    datas={'name': 'xxxx ', 'leixing': '2', 'data': 'BBPPPPBPPPBPBBBBPBPB', 'f': '**√', 'z': '√√*√√√', 'l': '√√√x√x', 't': '√x√√x√'}

    效果如下: https://z3.ax1x.com/2021/04/26/gS1jr6.jpg

    6 replies    2021-04-27 00:37:19 +08:00
    imn1
        1
    imn1  
       Apr 26, 2021   ❤️ 2
    图片和例子不同,逻辑对应不了
    princelai
        2
    princelai  
       Apr 26, 2021   ❤️ 1
    描述的不清楚没能理解
    no1xsyzy
        3
    no1xsyzy  
       Apr 26, 2021   ❤️ 4
    (等你描述清楚了,你也就写出来了。
    chionetw5
        4
    chionetw5  
       Apr 26, 2021   ❤️ 1
    datas={'name': 'xxxx ', 'leixing': '2', 'data': 'BBPPPPBPPPBPBBBBPBPB', 'f': '**√√', 'z': '√√*√√√', 'l': '√√√x√x', 't': '√x√√x√'}
    group_data = [datas['data'][_:_+3] for _ in range(0,len(datas['data']), 3)]
    for index, data in enumerate(group_data):
    print(datas['name'], datas['leixing'], data, datas['f'][index:index+1], datas['z'][index:index+1], datas['l'][index:index+1], datas['t'][index:index+1])
    hellogitooxx
        5
    hellogitooxx  
    OP
       Apr 26, 2021
    @chionetw5 感谢你,就是这个意思
    zzxgz
        6
    zzxgz  
       Apr 27, 2021
    leixing 还行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2593 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 12:47 · PVG 20:47 · LAX 05:47 · JFK 08:47
    ♥ Do have faith in what you're doing.