首页 > 编程知识 正文

cmath头文件包含了什么函数,什么情况用math头文件

时间:2023-05-06 00:13:37 阅读:167244 作者:3343

import os

导入书

#-* -编码: CP 936-* -

导入代码

from sys import argv

defreplace_all_files(path ) :

cnt=0

for root,dirs,filesinOS.walk(path ) :

for name in files:

ifname.Endswith(.CPP ) ) :

f=codecs.open(OS.path.join ) root,name ),' rb ' ) )

text=f.read ()

text1=text

iftext.find(STDafx.h () ) 0:

key='#include 'stdafx.h'rn '

if text [ :3 ]==codecs.BOM _ utf 83360

text1=' % s % s % s ' % (codecs.BOM _ utf8,key,text[3:] () ) ) ) ) ) )。

else:

text1='%s%s' % (key,text )

f.seek(0) )。

f.truncate () )

f.write(text1)。

cnt=cnt 1

print ' [ % d ] relpace file : ' % CNT OS.path.join (root,name ) ) ) ) ) ) ) )。

f.close () )

if __name__=='__main__':

try:

replace_all_files(argv[1] )

except Exception,e:

print e.message

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。