单行Python导入的多个别名

Dan*_*sio 7 python import alias

我可以在Python中导入模块,在一行中为它提供两个或更多别名吗?

这有两条线:

from time import process_time as tic
from time import process_time as toc
Run Code Online (Sandbox Code Playgroud)

这不起作用,但我希望能够写出如下内容:

from time import process_time as tic,toc
Run Code Online (Sandbox Code Playgroud)

Fra*_*sco 12

你可以这样做

from time import process_time as tic, process_time as toc
Run Code Online (Sandbox Code Playgroud)


Ith*_*ion 5

你可以做

from time import process_time as tic

toc = tic
Run Code Online (Sandbox Code Playgroud)