using PythonCall
= pyimport("re")
re = re.findall("[a-zA-Z]+", "PythonCall.jl is very useful!") words
Python list: ['PythonCall', 'jl', 'is', 'very', 'useful']
目前推荐使用 PythonCall.jl。它的使用非常简单,就像下面这样:
using PythonCall
= pyimport("re")
re = re.findall("[a-zA-Z]+", "PythonCall.jl is very useful!") words
Python list: ['PythonCall', 'jl', 'is', 'very', 'useful']
PythonCall.jl
还同时提供了姊妹包 juliacall
以实现在 Python 中调用 Julia。这里也提供了一个简单的例子:
import numpy as np
from juliacall import Main as jl
= jl.rand(range(10), 3, 5)
x sum(x, axis=0) np.