This commit is contained in:
guanjihuan 2022-05-20 14:25:42 +08:00
parent 0209b30e76
commit 77b00904b9
3 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import guan
guan.change_directory_by_replacement(current_key_word='codes', new_key_word='data')
guan.change_directory_by_replacement(current_key_word='code', new_key_word='data')
with open('data.txt', 'w') as f: # 保存数据
f.write('Hello world')

View File

@ -1,4 +1,4 @@
import guan
guan.change_directory_by_replacement(current_key_word='cloud/codes', new_key_word='local/data')
guan.change_directory_by_replacement(current_key_word='cloud/code', new_key_word='local/data')
with open('data.txt', 'w') as f: # 保存数据
f.write('Hello world')

View File

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