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();//调用这个方法
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/jestin/p/11899587.html
今日推荐