print和import的更多信息

1.使用逗号输出

2.把某件事作为另一件事导入

从模块导入函数:

import somemodule
from somemodule import somefunction
from somemodule import somefunction, anotherfunction, yetanotherfunction
from somemodule import *

在语句末尾增加一个as子句,可以给出想使用的别名:

from module1 import open as open1
from module2 import open as open2

results matching ""

    No results matching ""