<s> from __future__ import with_statement <EOL> import optparse <EOL> import sys <EOL> def main ( ) : <EOL> p = optparse . OptionParser ( ) <EOL> p . add_option ( '<STR_LIT>' , '<STR_LIT>' , action = "<STR_LIT:store>" , <EOL> type = "<STR_LIT:string>" , dest = "<STR_LIT:filename>" , <EOL> help = "<STR_LIT>" , default = None ) <EOL> p . add_option ( '<STR_LIT>' , '<STR_LIT>' , action = "<STR_LIT:store>" , <EOL> type = "<STR_LIT:string>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" , default = None ) <EOL> options , arguments = p . parse_args ( ) <EOL> if options . filename : <EOL> f = open ( options . filename ) <EOL> content = f . read ( ) <EOL> f . close ( ) <EOL> else : <EOL> content = sys . stdin . read ( ) <EOL> content = content . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if options . outfile : <EOL> with open ( options . outfile , '<STR_LIT:w>' ) as f : <EOL> f . write ( content ) <EOL> else : <EOL> print ( content ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
