I am trying to use optparse (for parsing command line options for my script) and fileinput (to be able to provide data through a pipe or file).
import optparse, fileinput parser = OptionParser() parser.add_option("-v", action="store_true", dest="verbose") (options, args) = parser.parse_args() for line in fileinput.input: process(line)
However, fileinput tries to use the -v option as well as the file name, resulting in "There is no such file or directory error." So either I need to do fileinput args, or remove the parsed parameters from sys.argv, but I don't know how to do it. Any pointers?
source share