- Presentación
- Atención
- Ejemplo de código
WLanguage permite el uso de funciones Python en modo nativo (para obtener más información, consulte Python: Llamadas nativas). También es posible ejecutar funciones Python a través de funciones WLanguage. Hay varias funciones disponibles:
Atención - Los módulos ".py" deben estar en el disco, en la carpeta del ejecutable implementado, o en la ubicación especificada con la función PythonAddPath. Los módulos ".py" no se pueden encontrar si están integrados en la biblioteca del ejecutable.
- Python distingue entre mayúsculas y minúsculas. Los nombres de los módulos y de las funciones deben escribirse respetando las mayúsculas y minúsculas.
// Initialize the Python interpreter PythonInitialize(PYTHON_INSTALL_PATH + "\Python39\python3.dll") // Declare the import paths of the modules used PythonAddPath("D:\source.test\pythonProject\venv\Lib\site-packages") PythonAddPath("D:\source.test\pythonProject") // Solve 5x³+x²-3x+2=0 sEquation is string = "5*x**3+x**2-3*x+2" sListRoot is string = PythonExecute("main", "solver", sEquation) nNbRoot is int = StringCount(sListRoot, ",") + 1 Trace("The ""[%sEquation%]"" equation admits [%nNbRoot%] roots:") FOR n = 1 _TO_ nNbRoot Trace("r[%n%] = [%ExtractString(sListRoot, n, "", "")%]") END
Esta página también está disponible para…
|
|
|
|