python将目录切换为脚本所在目录

os.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))

原文地址:https://www.cnblogs.com/vanwoos/p/8143418.html