stdin stdout python: how to reuse the same input file twice?
I am quite new to Python and even newer to stdin stdout method. Nevertheless I need to make my script usable for UNIX commands, in order to make it possible for example to process 2 input files at once with my script. This script works perfectly well with command line arguments: newlist = [] def f1() .... def f2(input_file): vol_id = sys.argv[3] for line in input_file: if ... : line = line.replace('abc','def') line = line.replace('id', 'id'+vol_id) .... newlist.append(line) return newlist def main(): if len(sys.argv) < 4: print 'usage: ./myscript.py [file_in... file_out... volume_id]' sys.exit