久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

    <tfoot id='fie0l'></tfoot>

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

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

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

        “無法將'int'對象隱式轉換為str"錯誤

        quot;Can#39;t convert #39;int#39; object to str implicitlyquot; error (Python)(“無法將int對象隱式轉換為str錯誤(Python))
      1. <i id='YWx4Y'><tr id='YWx4Y'><dt id='YWx4Y'><q id='YWx4Y'><span id='YWx4Y'><b id='YWx4Y'><form id='YWx4Y'><ins id='YWx4Y'></ins><ul id='YWx4Y'></ul><sub id='YWx4Y'></sub></form><legend id='YWx4Y'></legend><bdo id='YWx4Y'><pre id='YWx4Y'><center id='YWx4Y'></center></pre></bdo></b><th id='YWx4Y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YWx4Y'><tfoot id='YWx4Y'></tfoot><dl id='YWx4Y'><fieldset id='YWx4Y'></fieldset></dl></div>

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

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

                  <tbody id='YWx4Y'></tbody>
                  <bdo id='YWx4Y'></bdo><ul id='YWx4Y'></ul>
                • 本文介紹了“無法將'int'對象隱式轉換為str"錯誤(Python)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試測試某個數字的十進制表示是否至少包含兩次數字 9,所以我決定這樣做:

                  I am trying to test if the decimal representation of a certain number contains the digit 9 at least twice, so I decided to do something like that:

                  i=98759102
                  string=str(i)
                  if '9' in string.replace(9, '', 1): print("y")
                  else: print("n")
                  

                  但 Python 總是以TypeError: Can't convert 'int' object to str implicitly"響應.

                  But Python always responds with "TypeError: Can't convert 'int' object to str implicitly".

                  我在這里做錯了什么?是否有更智能的方法來檢測某個數字在整數的十進制表示中包含的頻率?

                  What am I doing wrong here? Is there actually a smarter method to detect how often a certain digit is contained in the decimal representation of an integer?

                  推薦答案

                  你的問題在這里:

                  string.replace(9, '', 1)
                  

                  您需要將 9 設為字符串文字,而不是整數:

                  You need to make 9 a string literal, rather than an integer:

                  string.replace('9', '', 1)
                  

                  至于計算字符串中 9 出現次數的更好方法,請使用 str.count():

                  As for a better way to count the occurrences of 9 in your string, use str.count():

                  >>> i = 98759102
                  >>> string = str(i)
                  >>> 
                  >>> if string.count('9') > 2:
                      print('yes')
                  else:
                      print('no')
                  
                  
                  no
                  >>>
                  

                  這篇關于“無法將'int'對象隱式轉換為str"錯誤(Python)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)

                    <small id='3VO3g'></small><noframes id='3VO3g'>

                      <legend id='3VO3g'><style id='3VO3g'><dir id='3VO3g'><q id='3VO3g'></q></dir></style></legend>
                        <tbody id='3VO3g'></tbody>
                    • <i id='3VO3g'><tr id='3VO3g'><dt id='3VO3g'><q id='3VO3g'><span id='3VO3g'><b id='3VO3g'><form id='3VO3g'><ins id='3VO3g'></ins><ul id='3VO3g'></ul><sub id='3VO3g'></sub></form><legend id='3VO3g'></legend><bdo id='3VO3g'><pre id='3VO3g'><center id='3VO3g'></center></pre></bdo></b><th id='3VO3g'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3VO3g'><tfoot id='3VO3g'></tfoot><dl id='3VO3g'><fieldset id='3VO3g'></fieldset></dl></div>
                    • <tfoot id='3VO3g'></tfoot>

                          <bdo id='3VO3g'></bdo><ul id='3VO3g'></ul>

                          1. 主站蜘蛛池模板: 欧美日韩中文字幕在线 | 国产精品一区二区在线免费观看 | 97人澡人人添人人爽欧美 | 日韩一区在线观看视频 | 成人av免费网站 | 天天干天天爱天天 | 亚洲欧美日韩精品久久亚洲区 | 欧美性久久 | 一a级片 | 日本中文字幕一区 | 中文字幕在线三区 | 色必久久| 亚洲国产精品一区 | 福利视频一区二区 | 久久亚洲国产 | 99久久久久 | 在线中文字幕第一页 | 欧美a在线看 | 欧美国产日韩成人 | 欧美一区二区三区在线观看 | 色婷婷激情 | 欧美日韩精品在线一区 | 欧美日韩久久精品 | 午夜免费观看体验区 | 久久亚洲国产精品 | 欧日韩在线 | 国产在线精品一区 | 日韩av手机在线观看 | 亚洲香蕉 | 日韩精品在线视频 | www.色53色.com| 瑟瑟免费视频 | av手机在线看 | 国产精品激情小视频 | 国产亚洲精品久久yy50 | 亚洲国产成人av好男人在线观看 | 国产乱码精品一品二品 | 成人在线视频网 | 91av在线视频观看 | 成人性生交大片免费看中文带字幕 | 一区视频在线免费观看 |