using System;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;

namespace PythonSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //study1
            var scriptEngine = Python.CreateEngine();
            scriptEngine.Execute("print \"hello world\"");
            Console.WriteLine("press random key,and contiue...");
            Console.ReadLine();

            //study2
            ScriptRuntime py = Python.CreateRuntime();
            dynamic helloworld = py.UseFile("helloworld.py");
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine(helloworld.welcome("Employee #{0}"), i);
            }
            Console.ReadLine();
        }
    }
}

相关文章:

  • 2021-07-18
  • 2022-03-06
  • 2021-11-29
  • 2021-06-21
  • 2021-05-26
  • 2021-11-09
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2021-05-24
  • 2021-11-09
  • 2021-08-06
  • 2022-01-08
  • 2021-12-31
  • 2022-02-25
  • 2021-09-30
相关资源
相似解决方案