# -*-coding:utf-8 -*-
importcsv
importsys
reload(sys)
sys.setdefaultencoding('utf8')
importos
importshutil
defgetFileList(path,company_name):
path = path+r'\\'+company_name
f_list = os.listdir(path)
html_list = []
foriinf_list:
ifos.path.splitext(i)[1] =='.html':
html_list.append(i)
returnhtml_list
defReplace(template,filename,company_name):
lines =open(template+r'\\'+filename).readlines()
new_file = company_name+r'\\'+filename
fp =open(new_file,'w')
forlineinlines:
fp.write(line.replace('深圳市坤德物流有限公司',company_name))
fp.close()
return'success'
if__name__=='__main__':
company_Info = csv.reader(open('company_name.csv'))
company_List = []
forrowincompany_Info:
company_List.append(row)
printcompany_List
foriincompany_List:
company_name = i[0]
template = i[1]
shutil.copytree(template,company_name)
real_path = os.path.split(os.path.realpath(__file__))[0]
html_list = getFileList(real_path,company_name)
company_name =company_name.decode('gbk')
#html_list = getfileNmae('C:\\Users\\x_likangqi\\Documents\\nksebx\\nksebx.cn')
forfile_nameinhtml_list:
Replace(template,file_name,company_name)
在数值计算中,常用差分近似微分.最简单的差分格式有向前、向后和中心3种.
向前差分:f'(n)=f(n+1)-f(n)
向后差分:f'(n)=f(n)-f(n-1)
中心差分:f'(n)=[f(n+1)-f(n-1)]/2
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)