c#里面调用python

#coding=utf-8
print("你好,我是测试文件")
def Texts():
   
    return [6, 2, 3, 1, 5, 4]
using IronPython.Hosting;

namespace LanguageCall
{
    class Program
    {
        static void Main(string[] args)
        {
            dynamic py = Python.CreateRuntime().UseFile("C:\\Users\\程晓芳\\Desktop\\LanguageCall\\hello.py");//执行这个PY文件
            IronPython.Runtime.List a = py.Texts();//调用这个方法
        }
    }
}

 

posted @ 2020-05-18 16:07  王者2  阅读(300)  评论(0)    收藏  举报