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

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

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

      输入中的 print 语句返回“none"

      print statement inside of input returns with a quot;nonequot;(输入中的 print 语句返回“none)
        <bdo id='6xVhJ'></bdo><ul id='6xVhJ'></ul>

            <tbody id='6xVhJ'></tbody>
          1. <small id='6xVhJ'></small><noframes id='6xVhJ'>

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

              <tfoot id='6xVhJ'></tfoot>
              <legend id='6xVhJ'><style id='6xVhJ'><dir id='6xVhJ'><q id='6xVhJ'></q></dir></style></legend>

                本文介绍了输入中的 print 语句返回“none"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在开发一个小程序,我想使用:

                I am working on a little program and I want to use:

                ans = int(input(print(multi,'x',num,'=')))
                

                这很好用,除了在打印 print 语句后它说 none 之外.喜欢:

                This works well except for the fact that after it prints the print statement it says none. like:

                49 x 7 =
                None
                

                如果可能,如何删除无"?我也搜索了这个问题,但没有什么是关于在输入中返回 none 的.

                How would on remove the "none" if possible? Also I did search this problem but nothing was about returning a none inside of an input.

                推荐答案

                inputprompt 字符串作为参数,它会自动打印,但 print 返回 None;这是由 input 打印的.您的代码相当于:

                input takes a prompt string as its argument, which it will print automatically, but print returns None; it is this that gets printed by input. Your code is equivalent to:

                prompt = print(...) # prompt == None
                ans = int(input(prompt)) 
                

                改为使用 str.format 构建提示并将其直接传递给 input:

                ans = int(input('{0}x{1}='.format(multi, num)))
                

                这篇关于输入中的 print 语句返回“none"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 数据帧进行分组)
                  <tbody id='rLtOq'></tbody>

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

                    <legend id='rLtOq'><style id='rLtOq'><dir id='rLtOq'><q id='rLtOq'></q></dir></style></legend>
                    • <tfoot id='rLtOq'></tfoot>

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