问题
Can I import module in Python giving it two or more aliases in one line?
With two lines this works:
from time import process_time as tic
from time import process_time as toc
This doesn't work, but I would want to be able to write something like:
from time import process_time as tic,toc
回答1:
You can do that with
from time import process_time as tic, process_time as toc
回答2:
You could do
from time import process_time as tic
toc = tic
来源:https://stackoverflow.com/questions/36481111/multiple-aliases-on-one-line-python-import