how to take list as command line arguments in python

The solution for “how to take list as command line arguments in python” can be found here. The following code will assist you in solving the problem.

>>> input = “[2,3,4,5]”
>>> map(float, input.strip(‘[]’).split(‘,’))
[2.0, 3.0, 4.0, 5.0]
>>> A = map(float, input.strip(‘[]’).split(‘,’))
>>> print(A, type(A))
([2.0, 3.0, 4.0, 5.0], )

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in