我可以在Python中导入模块,在一行中为它提供两个或更多别名吗?
有两条线可以使用:
from time import process_time as tic
from time import process_time as toc
这不起作用,但我希望能够写出如下内容:
from time import process_time as tic,toc
答案 0 :(得分:9)
你可以用
做到这一点from time import process_time as tic, process_time as toc
答案 1 :(得分:3)
你可以做到
from time import process_time as tic
toc = tic