Is there any difference between:
__file__
and
sys.argv[0]
Because both seem to be doing the same thing: they hold the name of the script.
If there is no difference, then why is it that __file__
is used in almost all someplaces whereas I have never seen sys.argv[0]
being used.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…