Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

วิธี Import All Submodules ของ Python Namespace Package

from module import * import ทุก submodules จาก package/module

>>> from myModule import *

คำเตือน: ใช้ import * กับโค้ดใหญ่จะยุ่งยาก ลบไม่ได้ เพราะยากจะรู้ว่าชื่อไหนมาจาก module ไหน clutter namespace และจำกัดการตั้งชื่อในโมดูลของตัวเอง