Created
November 16, 2022 14:15
-
-
Save wkentaro/96d0cd0774390f5981f145f3b87daf19 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 | |
import sys | |
import numpy as np | |
arr = sys.stdin.read().split() | |
arr = np.array(arr) | |
for operation in sys.argv[1:]: | |
if operation.startswith("."): | |
if operation == ".T": | |
arr = arr.T | |
else: | |
raise NotImplementedError | |
else: | |
shape = tuple(map(int, operation.split(","))) | |
arr = arr.reshape(shape) | |
np.savetxt(sys.stdout.buffer, arr, fmt="%s") |
Author
wkentaro
commented
Nov 16, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment