passing arguments in python from command line as key value

The solution for “passing arguments in python from command line as key value” can be found here. The following code will assist you in solving the problem.

import sys
filename = sys.argv[1]
args = dict([arg.split(‘=’, maxsplit=1) for arg in sys.argv[2:]])
print filename
print args

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

More questions on [categories-list]

0
inline scripts encapsulated in