8 Respostas
+ 8
You can use subprocess to do it
https://code.sololearn.com/c7zzD6LGuE1k/?ref=app
+ 6
subprocess.call("python source.py parameters")
+ 2
You mean calling it with arguments from the console?
I doubt you can do that here.
+ 1
Try simply editing the argv variable maybe, that's the closest you'll get.
argv = ["arg1"]
print(argv[0]) # Prints arg1
Keep coding!
- inxane
0
By passing parameters, do you mean to functions? Do you have an example of what you want to do?
0
I mean this: python myscript.py --param1=val1 --param2=val2, similar to console
0
How can I pass argv parameters?