Python ã®ã³ã¼ããçºãã¦ãã¨æã ç»å ´ãã¦ããããã¤â if __name__ == '__main__': ãã¼ã£ã¨è¬ã ã£ããã©ããã£ã¨æå³ãåãã£ãï¼ãifã®ä¸èº«ã¯ã¹ã¯ãªãããã¡ã¤ã«ã¨ãã¦å®è¡ãããæã«ã ãå®è¡ããããããã ãããªçå± ã¹ã¯ãªãããã¡ã¤ã«ã¨ãã¦å®è¡ããã㨠__name__ ã£ã¦ããå¤æ°ï¼ãã« '__main__' ã£ã¦ããæååãå ¥ãã Python ã®ã¹ã¯ãªããã import ãããæ㯠__name__ ã«ã¯ import ãããååãå ¥ãã ã¾ãç¾èã¯ä¸è¦ã«ãããã£ã¦ãã¨ã§ããã㪠test.py ãæ¸ãã¦ã¿ãã #! /usr/bin/env python # -*- coding: utf-8 -*- print 'import ã§ãå®è¡ããã __name__ = %s' % __name__ if __name__ == '__main__':
{{#tags}}- {{label}}
{{/tags}}