Python import 关键字

定义和用法

import 关键字用于导入模块。

实例

导入 datetime 模块并显示当前日期和时间:

import datetime

x = datetime.datetime.now()
print(x)

亲自试一试