import os
#这个函数的作用是对传入的值进行加2操作
def createPath():
print('ok!!!!!!!!!!')
if not os.path.exists(r'C:\Users\admin\Desktop\testMapping\001'):
os.mkdir(r'C:\Users\admin\Desktop\testMapping\001')
def createTable(dwi,dwiName,sdiName,dwiField,dwiProperty):
# 定义要写入txt的内容
content = "Hello world! This is a %s \n"% (dwi)
for i in range(len(dwiField)):
if i<len(dwiField)-1:
content += "%s %s ,\n"% (str(dwiField[i]),str(dwiProperty[i]))
else:
content += "%s %s " % (str(dwiField[i]), str(dwiProperty[i]))
# 打开txt文件,文件路径和文件名需要根据实际情况修改
with open(r"C:\Users\admin\Desktop\testMapping\001\%s.txt"% (dwi), "w") as f:
# 将内容写入文件中
f.write(content)
# 提示写入成功
print("Content has been written to %s.txt"% (dwi))