亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Python動態(tài)加載模塊的3種方法

 更新時間:2014年11月22日 09:53:42   投稿:junjie  
這篇文章主要介紹了Python 動態(tài)加載模塊的3種方法,本文分別使用使用系統(tǒng)函數(shù)__import_()、使用imp 模塊、使用exec三種方法實現(xiàn),需要的朋友可以參考下

1、使用系統(tǒng)函數(shù)__import_()

復制代碼 代碼如下:

stringmodule = __import__('string')

2、使用imp 模塊

復制代碼 代碼如下:

import imp
stringmodule = imp.load_module('string',*imp.find_module('string'))

3、使用exec

復制代碼 代碼如下:

import_string = "import string as stringmodule"
exec import_string

相關文章

最新評論