allow for same file to be read in as ascii and output as binary

This commit is contained in:
Bryan Herman 2014-04-09 23:08:17 -04:00
parent ee514f5d99
commit 18f42076fb

View file

@ -18,9 +18,8 @@ def ascii_to_binary(ascii_file, binary_file):
"""
# Open ASCII and binary files
# Open ASCII file
ascii = open(ascii_file, 'r')
binary = open(binary_file, 'wb')
# Set default record length
record_length = 4096
@ -29,6 +28,9 @@ def ascii_to_binary(ascii_file, binary_file):
lines = ascii.readlines()
ascii.close()
# Open binary file
binary = open(binary_file, 'wb')
idx = 0
while idx < len(lines):
# Read/write header block