Update change_directory_by_replacement.py

This commit is contained in:
guanjihuan 2022-02-16 19:38:10 +08:00
parent cae7ec4f51
commit 881d1492c4

View File

@ -1,5 +1,5 @@
import os
code_path = os.getcwd() # 查看当前代码文件的路径
code_path = os.getcwd() # 当前代码文件的路径
data_path = code_path.replace('\\', '/') # \改为/,防止路径报错
data_path = code_path.replace('codes', 'data') # 把路径中codes改为data
if os.path.exists(data_path) == False: # 如果文件夹不存在,新建文件夹