134ï¼å®è¡ãã¦ããã¹ã¯ãªããã®ãã¹ãæ±ãã __file__ ãç¨ããã¨ãã¹ã¯ãªããã¸ã®ç¸å¯¾ãã¹ããåå¾ã§ãã¾ãã Python 2.3 以åã§ã¯ __file__ ã使ããªãã®ã§ sys.argv[0]? ã§ä»£ç¨ãã¾ãã Python ã¤ã³ã¿ããªã¿ã¸ã®æåã®å¼æ°ãããªãã¡ãã¹ã¯ãªããã¸ã®ç¸å¯¾ãã¹ãã¨ãªãã¾ãã ãã¹ã¯ãªããã®ãããã£ã¬ã¯ããªã®ç¸å¯¾ãã¹ããå¾ãã«ã¯ãã¹ã¯ãªããã¸ã®ãã¹ããå¼æ°ã«ã㦠os.dirname é¢æ°ãå¼ã³ã¾ãã ãã¹ã¯ãªããã¨åããã£ã¬ã¯ããªã®ãã¡ã¤ã«ã¸ã®ç¸å¯¾ãã¹ããå¾ãã«ã¯ãã¹ã¯ãªããã®ãããã£ã¬ã¯ããªã®ãã¹ãã¨ããã¡ã¤ã«åãã os.path.join é¢æ°ã§ãããã¾ãã ãã¹ã¯ãªããåãã ããå¾ãããã° os.basename(__file__) ãç¨ãã¾ããåã絶対ãã¹ããå¿ è¦ã§ããã°åãç¸å¯¾ãã¹ããå¼æ°ã« os.path.abspath ãå¼ã³ã¾ãã
{{#tags}}- {{label}}
{{/tags}}