PythonスクリプトをPerlでどのように呼び出すか。

PerlでPythonスクリプトを呼び出すには、system関数またはバックティック演算子を使用してシェルコマンドを実行できます。以下に、その2つの方法の例を示します:

  1. システム (shisutemu)
system("python path/to/your_python_script.py");
  1. バッククォート
my $output = `python path/to/your_python_script.py`;
print $output;

Pythonスクリプトを呼び出す際には、正しいパスが提供されていることを確認してください。また、Pythonスクリプトにパラメータを渡すこともできます。例:

my $arg1 = "hello";
my $arg2 = "world";
system("python path/to/your_python_script.py $arg1 $arg2");
コメントを残す 0

Your email address will not be published. Required fields are marked *


广告
広告は10秒後に閉じます。
bannerAds