• <small id='WgqGS'></small><noframes id='WgqGS'>

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

      2. <tfoot id='WgqGS'></tfoot>

        <legend id='WgqGS'><style id='WgqGS'><dir id='WgqGS'><q id='WgqGS'></q></dir></style></legend>

        'else if' 的正确语法是什么?

        时间:2024-04-20

          <bdo id='Wl0cY'></bdo><ul id='Wl0cY'></ul>

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

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

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

                • 本文介绍了'else if' 的正确语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是一名新的 Python 程序员,正在从 2.6.4 飞跃到 3.1.1.在我尝试使用else if"语句之前,一切都很好.解释器在else if"中的if"之后给了我一个语法错误,原因我似乎无法弄清楚.

                  I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.

                  def function(a):
                      if a == '1':
                          print ('1a')
                      else if a == '2'
                          print ('2a')
                      else print ('3a')
                  
                  function(input('input:'))
                  

                  我可能遗漏了一些非常简单的东西;但是,我自己无法找到答案.

                  I'm probably missing something very simple; however, I haven't been able to find the answer on my own.

                  推荐答案

                  在python中else if"拼写为elif".
                  此外,您需要在 elifelse 之后使用冒号.

                  In python "else if" is spelled "elif".
                  Also, you need a colon after the elif and the else.

                  简单问题的简单答案.当我第一次开始时(在过去几周内),我遇到了同样的问题.

                  Simple answer to a simple question. I had the same problem, when I first started (in the last couple of weeks).

                  所以你的代码应该是:

                  def function(a):
                      if a == '1':
                          print('1a')
                      elif a == '2':
                          print('2a')
                      else:
                          print('3a')
                  
                  function(input('input:'))
                  

                  这篇关于'else if' 的正确语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:builtins.TypeError:必须是 str,而不是 bytes 下一篇:Pandas 按递增顺序编号组内的行数

                  相关文章

                • <small id='rXI4W'></small><noframes id='rXI4W'>

                • <tfoot id='rXI4W'></tfoot>

                      <bdo id='rXI4W'></bdo><ul id='rXI4W'></ul>
                    <legend id='rXI4W'><style id='rXI4W'><dir id='rXI4W'><q id='rXI4W'></q></dir></style></legend>

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