I am trying to get a numpy two-dimensional array from user input except it does not work properly as input() returns a 'str' type while the numpy array() method expects a tuple:
import numpy as N
def main():
A = input() # the user is expected to enter a 2D array like [[1,2],[3,4]] for example
A = N.array(A) # since A is a 'str' A
print(A.shape) # output is '()' instead of '(2, 2)' showing the previous instruction didn't work as expected
if __name__ == "__main__":
main()
So my question would be: How can I turn the input string into a tuple so that the array() method properly turns the input into a numpy 2D array?
Thanks in advance.