recipe-577533.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:code 作者: ActiveState 项目源码 文件源码
def stripAxisCode(fileName):
  """copy lines from in file to out file up to first occurance
     of the string 'org.apache.axis', then just write closing brace.
     hasAxisCode detects of the file was already processed such that
     this is an idempotent operation.
  """ 
  hasAxisCode = False
  fin = open(fileName, 'r')
  outName = ''.join([fileName, '.tmp'])
  fout = open(outName, 'wr')
  for line in fin:
    if (string.find(line, 'org.apache.axis') != -1 and
        string.find(line, 'extends') == -1 and
        string.find(line, 'implements') == -1):
      hasAxisCode = True
      break
    else:
      fout.write(line)

  fin.close() 
  if hasAxisCode:
    fout.write("}\n")
  fout.close
  shutil.move(outName, fileName)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号