13 Apr 2026 (Module 3種import方法 P.104-106)

Run Settings
LanguagePython
Language Version
Run Command
def a(): print("I am from main function a") a() # case 1 : import module by name import dio as d import tria as t d.a() t.a() print(d.x,d._x,t.x, t._x) #function/variable都係地址 # case 2 : from module import * , import everything except _ from dio import * a() print(x) #留意用*係所有野會過到黎, 除左_係過唔到黎, 所以過唔到dio.py入面既_x from tria import * a() print(x) # case 3 : from module import a, selection import, run through modules<--多數用呢個, 可以選擇性去簡, 唔好浪費咁多name space from dio import x, _x from tria import a a() print(x,_x)
def a(): print("I am from dio's function a") x = 1 _x = 10
def a(): print("I am from tria's function a") x = 2 _x = 20
Editor Settings
Theme
Key bindings
Full width
Lines