from time import ctime
allows to call ctime()
directly, without time.ctime()
prefix. It is me, who was inconsistent comparing fully qualified names os.listdir()
with ctime()
alone.
import all functions vs. import specific function [closed]
-
30-07-2022 - |
문제
In Python,
import shutil, os
allows me to call os.environ
, os.path.exists(folder)
, os.listdir(pool)
, shutil.rmtree(folder)
and shutil.copyree()
. It seems that I call any function, defined in those modules. Nevertheless, I cannot call ctime()
once I have imported import time
. I must import ctime
explicitly, by
from time import ctime
Why is such inconsistency? I find it difficult to program in such unpredictability.
해결책
제휴하지 않습니다 StackOverflow