I am beginner in Python programing, I want to pass a complex object (Python dictionary or class object) as an argument to a python script using command line (cmd). I see that sys.argv gets only string parameters.
Here is an example of what I want:
class point(object):
def __init__(self,x,y):
self.__x=x
self.__y=y
p=point(4,8)
import os
os.system('""xxxxxx.exe" "-s" "../create_scenario.py" "'+ p +'""')
The xxxxxx.exe is a program which accept to run a python script with the -s option. Thanks for all!!!
os.system
is really bad. – segfolt Apr 18 at 11:58__x
is for name mangling which I'm pretty sure you don't need in thepoint
class. You might have wanted a private variable_x
if you have getter and setter functions/property but otherwise just leave it asself.x
– jamylak Apr 18 at 11:59