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

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

    <bdo id='Wmyhb'></bdo><ul id='Wmyhb'></ul>
  • <legend id='Wmyhb'><style id='Wmyhb'><dir id='Wmyhb'><q id='Wmyhb'></q></dir></style></legend>
    1. <tfoot id='Wmyhb'></tfoot>

        将元组项拆分为单独的变量

        Split tuple items to separate variables(将元组项拆分为单独的变量)

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

              <legend id='4No2E'><style id='4No2E'><dir id='4No2E'><q id='4No2E'></q></dir></style></legend>

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

                  <tbody id='4No2E'></tbody>

                1. 本文介绍了将元组项拆分为单独的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Python 中有如下所示的元组:

                  I have tuple in Python that looks like this:

                  tuple = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
                  

                  我想把它拆分出来,这样我就可以从独立的元组中获取每个项目,这样我就可以做这样的事情:

                  and I wanna split it out so I could get every item from tuple independent so I could do something like this:

                  domain = "sparkbrowser.com"
                  level = 0
                  url = "http://facebook.com/sparkbrowser"
                  text = "Facebook"
                  

                  或类似的东西,我需要将每个项目分开.我尝试在元组上使用 .split(",") ,但出现错误,提示元组没有拆分选项.

                  or something similar to that, My need is to have every item separated. I tried with .split(",") on tuple but I've gotten error which says that tuple doesn't have split option.

                  推荐答案

                  Python可以自然解包序列.

                  Python can unpack sequences naturally.

                  domain, level, url, text = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
                  

                  这篇关于将元组项拆分为单独的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 数据帧进行分组)

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

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

                      <tbody id='anphq'></tbody>

                    • <bdo id='anphq'></bdo><ul id='anphq'></ul>

                      1. <legend id='anphq'><style id='anphq'><dir id='anphq'><q id='anphq'></q></dir></style></legend>