Created
March 26, 2015 15:06
-
-
Save jbernhard/85c22c540bf4afe23d1d to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python3 | |
""" Read an array from stdin and write to a numpy file. """ | |
import sys | |
import numpy as np | |
def main(): | |
if len(sys.argv) != 2: | |
print('usage: {} output_file'.format(sys.argv[0])) | |
exit(1) | |
filename = sys.argv[1] | |
arr = np.array([l.split() for l in sys.stdin.buffer], | |
dtype=float).squeeze() | |
np.save(filename, arr) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment