graphicstest/graphicstestharness/batch/replace.py
changeset 0 5d03bc08d59c
child 18 5e30ef2e26cb
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 import sys
       
    18 # first argument is path to file to modify
       
    19 filePath=sys.argv[1]
       
    20 outFile=filePath
       
    21 # second argument is string to find
       
    22 findstring=sys.argv[2]
       
    23 # third argument is string to replace first find with
       
    24 replacestring=sys.argv[3]
       
    25 
       
    26 inF = open(filePath,'rb')
       
    27 s=unicode(inF.read(),'utf-16')
       
    28 inF.close()
       
    29 
       
    30 outtext=s.replace(findstring,replacestring)
       
    31 
       
    32 outF = open(outFile,'wb')
       
    33 outF.write(outtext.encode('utf-16'))
       
    34 outF.close()