【python】添加路径

动态添加路径

import sys

# 添加当前工作目录到 Python 的路径中
current_dir = os.getcwd()
if current_dir not in sys.path:
    sys.path.append(current_dir)

posted @ 2025-01-20 09:27  ReRound  阅读(10)  评论(0)    收藏  举报