mirror of
https://github.com/plasmaofthedawn/adventofcode.git
synced 2025-08-24 01:52:04 -05:00
19 lines
511 B
Python
19 lines
511 B
Python
import sys
|
|
import argparse
|
|
|
|
|
|
parser = argparse.ArgumentParser(prog="preprocess.py")
|
|
parser.add_argument("input", nargs='?', help="input file",
|
|
type=argparse.FileType('r'), default=sys.stdin)
|
|
parser.add_argument("-o", "--output", nargs='?', help="output file",
|
|
type=argparse.FileType('w'), default=sys.stdout)
|
|
|
|
args = parser.parse_args(sys.argv[1:])
|
|
|
|
contents = args.input.read()
|
|
|
|
args.output.write(
|
|
" ".join([str(ord(c)) for c in contents])
|
|
)
|
|
args.output.close()
|