Created
November 16, 2011 23:40
-
-
Save computercolin/1371887 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
import sys | |
if len(sys.argv) != 3: | |
sys.exit("Usage: flatten_input.py board_in flattened_board_out") | |
fin_name = sys.argv[1] | |
fout_name = sys.argv[2] | |
fin = open(fin_name) | |
rows = list() | |
for line in fin: | |
rows.append(line) | |
fin.close() | |
m = len(rows) | |
n = len(rows[0]) | |
print m, n | |
fout = open(fout_name, 'w') | |
fout.write("%s%s" % (chr(m), chr(n))) | |
for row in rows: | |
fout.write(row[0:-1]) | |
fout.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment