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

    <bdo id='AOCu5'></bdo><ul id='AOCu5'></ul>
    <tfoot id='AOCu5'></tfoot>
  • <legend id='AOCu5'><style id='AOCu5'><dir id='AOCu5'><q id='AOCu5'></q></dir></style></legend>

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

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

      1. 列出作為 python 包一部分的所有模塊?

        List all the modules that are part of a python package?(列出作為 python 包一部分的所有模塊?)

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

                <tbody id='0961S'></tbody>
              • <tfoot id='0961S'></tfoot>
              • <legend id='0961S'><style id='0961S'><dir id='0961S'><q id='0961S'></q></dir></style></legend>

                <small id='0961S'></small><noframes id='0961S'>

                  本文介紹了列出作為 python 包一部分的所有模塊?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有沒有一種簡單的方法可以找到所有作為 python 包一部分的模塊?我發現 這個舊討論,其中并不是真的有定論,但在我推出自己的基于 os.listdir() 的解決方案之前,我希望有一個明確的答案.

                  Is there a straightforward way to find all the modules that are part of a python package? I've found this old discussion, which is not really conclusive, but I'd love to have a definite answer before I roll out my own solution based on os.listdir().

                  推薦答案

                  是的,你想要基于 pkgutil 或類似的東西——這樣你就可以同等對待所有的包,不管它們是否在雞蛋里或 zips 左右(os.listdir 無濟于事).

                  Yes, you want something based on pkgutil or similar -- this way you can treat all packages alike regardless if they are in eggs or zips or so (where os.listdir won't help).

                  import pkgutil
                  
                  # this is the package we are inspecting -- for example 'email' from stdlib
                  import email
                  
                  package = email
                  for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
                      print "Found submodule %s (is a package: %s)" % (modname, ispkg)
                  

                  如何也導入它們?你可以像往常一樣使用 __import__:

                  How to import them too? You can just use __import__ as normal:

                  import pkgutil
                  
                  # this is the package we are inspecting -- for example 'email' from stdlib
                  import email
                  
                  package = email
                  prefix = package.__name__ + "."
                  for importer, modname, ispkg in pkgutil.iter_modules(package.__path__, prefix):
                      print "Found submodule %s (is a package: %s)" % (modname, ispkg)
                      module = __import__(modname, fromlist="dummy")
                      print "Imported", module
                  

                  這篇關于列出作為 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 包)
                  • <i id='b3Rxi'><tr id='b3Rxi'><dt id='b3Rxi'><q id='b3Rxi'><span id='b3Rxi'><b id='b3Rxi'><form id='b3Rxi'><ins id='b3Rxi'></ins><ul id='b3Rxi'></ul><sub id='b3Rxi'></sub></form><legend id='b3Rxi'></legend><bdo id='b3Rxi'><pre id='b3Rxi'><center id='b3Rxi'></center></pre></bdo></b><th id='b3Rxi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='b3Rxi'><tfoot id='b3Rxi'></tfoot><dl id='b3Rxi'><fieldset id='b3Rxi'></fieldset></dl></div>

                        <tfoot id='b3Rxi'></tfoot>
                      • <small id='b3Rxi'></small><noframes id='b3Rxi'>

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

                              <tbody id='b3Rxi'></tbody>
                            主站蜘蛛池模板: 久草在线在线精品观看 | 丁香婷婷久久久综合精品国产 | 久久国产精品-国产精品 | 亚洲成人日韩 | 91免费高清视频 | 婷婷福利视频导航 | 91亚洲国产成人久久精品网站 | 国产乱码精品一区二三赶尸艳谈 | 成人黄色在线 | 精品自拍视频在线观看 | 精品亚洲一区二区 | 殴美成人在线视频 | 日韩精品免费在线观看 | 午夜男人免费视频 | 亚洲成人福利在线观看 | 91热在线| 亚洲黄色高清视频 | 欧美激情精品久久久久久变态 | 欧美在线观看一区 | 亚洲第一网站 | 一区中文| aaa一区| 日韩网站在线观看 | 日韩中文字幕一区二区 | 亚洲国产精品一区二区三区 | 国产精品一区二区久久 | 中文字幕韩在线第一页 | 99久久婷婷国产综合精品 | 特级毛片 | www国产成人 | 久久国产一区 | 亚洲第一黄色网 | 欧美影院 | 亚洲人成在线播放 | 久久久精品在线 | 亚洲福利视频网 | 欧美久久免费观看 | 在线电影日韩 | 日本大片在线播放 | 一级a性色生活片久久毛片 一级特黄a大片 | 九九久久精品 |