Say you have a class like this:
class MyClass:
def __init__(self, var1):
self.var = var1
....
This class, in python, works only when you assign a value:
x = MyClass("Hi")
So basically, my question is whether I can send a variable from php to execute a python class, and return its output (it's string) and continue to execute my php code?
Any suggestions?
SOLUTION
in php:
$var = "something";
$result = exec("python fileName.py .$var")
in python:
import sys
sys.argv[0] # this is the file name
sys.argv[1] # this is the variable passed from php