You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example matches Python strings using the JavaScript regular expression object
80
+
and Python reads the captured group from the JavaScript result and prints: `Here
81
+
is what we found: 'This string was matched by Graal.js'`.
82
+
83
+
As a more complex example, we can read a file using R, process the data in
84
+
Python, and use R again to display the resulting data image, using both R and
85
+
Python libraries in conjunction. To run it, first install the
86
+
required R library:
87
+
```shell
88
+
$ R -e 'install.packages("https://www.rforge.net/src/contrib/jpeg_0.1-8.tar.gz", repos=NULL)'
89
+
```
90
+
91
+
This example also uses [image_magix.py](http://graalvm.org/docs/examples/image_magix.py) and works
92
+
on a JPEG image input (you can try with [this image](https://www.graalvm.org/resources/img/python_demo_picture.jpg)). These files have to be in the same folder the script below is located in and executed from.
Finally, to interoperate with Java (only when running on the JVM), you can use
50
134
the `java` module:
51
135
```python
@@ -94,3 +178,6 @@ print(java.is_object(ArrayList)) # prints True, symbols are also host objects
94
178
print(java.is_function(my_list.add))# prints True, the add method of ArrayList
95
179
print(java.instanceof(my_list, ArrayList)) # prints True
96
180
```
181
+
182
+
See the [Polyglot Programming](https://www.graalvm.org/docs/reference-manual/polyglot-programming/) and the [Embed Languages](https://www.graalvm.org/docs/reference-manual/embed-languages/#Function_Python) reference
183
+
for more information about interoperability with other programming languages.
you can embed Python in your programs. For more detail, refer to the [Embed Languages](https://www.graalvm.org/docs/reference-manual/embed-languages/#Function_Python) reference.
0 commit comments