• <bdo id='4IKKH'></bdo><ul id='4IKKH'></ul>
      <i id='4IKKH'><tr id='4IKKH'><dt id='4IKKH'><q id='4IKKH'><span id='4IKKH'><b id='4IKKH'><form id='4IKKH'><ins id='4IKKH'></ins><ul id='4IKKH'></ul><sub id='4IKKH'></sub></form><legend id='4IKKH'></legend><bdo id='4IKKH'><pre id='4IKKH'><center id='4IKKH'></center></pre></bdo></b><th id='4IKKH'></th></span></q></dt></tr></i><div id='4IKKH'><tfoot id='4IKKH'></tfoot><dl id='4IKKH'><fieldset id='4IKKH'></fieldset></dl></div>

      <small id='4IKKH'></small><noframes id='4IKKH'>

    1. <tfoot id='4IKKH'></tfoot>

      <legend id='4IKKH'><style id='4IKKH'><dir id='4IKKH'><q id='4IKKH'></q></dir></style></legend>
    2. python - 获取元组列表第一个索引?

      python - get list of tuples first index?(python - 获取元组列表第一个索引?)

      <tfoot id='k7ARt'></tfoot>

              <tbody id='k7ARt'></tbody>

          1. <i id='k7ARt'><tr id='k7ARt'><dt id='k7ARt'><q id='k7ARt'><span id='k7ARt'><b id='k7ARt'><form id='k7ARt'><ins id='k7ARt'></ins><ul id='k7ARt'></ul><sub id='k7ARt'></sub></form><legend id='k7ARt'></legend><bdo id='k7ARt'><pre id='k7ARt'><center id='k7ARt'></center></pre></bdo></b><th id='k7ARt'></th></span></q></dt></tr></i><div id='k7ARt'><tfoot id='k7ARt'></tfoot><dl id='k7ARt'><fieldset id='k7ARt'></fieldset></dl></div>

            <small id='k7ARt'></small><noframes id='k7ARt'>

                <bdo id='k7ARt'></bdo><ul id='k7ARt'></ul>
                <legend id='k7ARt'><style id='k7ARt'><dir id='k7ARt'><q id='k7ARt'></q></dir></style></legend>
                本文介绍了python - 获取元组列表第一个索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                返回以下内容的最简洁方式是什么:

                What's the most compact way to return the following:

                给定一个元组列表,返回一个由元组第一个(或第二个,无关紧要)元素组成的列表.

                Given a list of tuples, return a list consisting of the tuples first (or second, doesn't matter) elements.

                为:

                [(1,'one'),(2,'two'),(3,'three')]
                

                返回列表将是

                [1,2,3]
                

                推荐答案

                如果两者都需要,请使用 zip

                use zip if you need both

                >>> r=(1,'one'),(2,'two'),(3,'three')
                >>> zip(*r)
                [(1, 2, 3), ('one', 'two', 'three')]
                

                这篇关于python - 获取元组列表第一个索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)
                <legend id='w90kf'><style id='w90kf'><dir id='w90kf'><q id='w90kf'></q></dir></style></legend>

                  <small id='w90kf'></small><noframes id='w90kf'>

                1. <tfoot id='w90kf'></tfoot>

                    • <bdo id='w90kf'></bdo><ul id='w90kf'></ul>
                    • <i id='w90kf'><tr id='w90kf'><dt id='w90kf'><q id='w90kf'><span id='w90kf'><b id='w90kf'><form id='w90kf'><ins id='w90kf'></ins><ul id='w90kf'></ul><sub id='w90kf'></sub></form><legend id='w90kf'></legend><bdo id='w90kf'><pre id='w90kf'><center id='w90kf'></center></pre></bdo></b><th id='w90kf'></th></span></q></dt></tr></i><div id='w90kf'><tfoot id='w90kf'></tfoot><dl id='w90kf'><fieldset id='w90kf'></fieldset></dl></div>

                            <tbody id='w90kf'></tbody>