[Python.Net]在c#.Net下调用Python的软件IronPython-1.1.1试用

http://www.codeplex.com/IronPython非常不错。
可以在C#里面运行py.能够参数传递。不错。
首先把IronPython.dll,IronMath.dll两个DLL
添加到你的VS里面的引用里
然后写上

using IronPython.Hosting;
using IronPython.Compiler;

写一个函数来使用:
漫画

PythonEngine engine;
engine = new PythonEngine();
string vs_dc9 = "http://www.dc9.cn";
engine.Globals["py_dc9"] = vs_dc9;
engine.Execute("py_dc9_test = str(len(py_dc9)) + py_dc9");
string py_dc9_test_vs = engine.EvaluateAs<string>("py_dc9_test");
MessageBox.Show(py_dc9_test_vs);

程序会弹出17http://www.dc9.cn
有意思吧。
但是,问题的关键在于IronPython没法Import很多的库,比如random库,比如codecs库都import不了!!!
太郁闷了!!!
只能import什么sys之类的。。晕
于是很多东西还需要在c#里面搞。
engine.ExecuteFile很有用哦~不过必须是没有头标记的UTF8的就是NO BOM UTF-8,不知道为什么这么shi….

10 comments

  1. Yimi 说道:

    不懂。
    坐沙发而已

  2. Yimi 说道:

    4242,我也觉得是火星文,博主你真是太厉害了,Yimi抱拳团团一拜,讨好地说道:“鄙人对各位的景仰之情,有如滔滔江水连绵不绝。”

  3. sipo 说道:

    唉,最近心情不好,发火星文来发泄~~

    lovehr 于 2008-3-26 23:32:48 回复

    是PR降为3了吧,哈哈,没关系,我都没PR的。。

  4. Doug Gertelman 说道:

    Hey there! Would you mind if I share your blog with my zynga group? There’s a lot of people that I think would really appreciate your content. Please let me know. Thanks

  5. Florentina Funnye 说道:

    I visited various websites but the audio feature for audio songs existing at this website is in fact excellent.

  6. Zack Quicho 说道:

    There are definitely a variety of details like that to take into consideration. That could be a nice level to deliver up. I supply the ideas above as normal inspiration however clearly there are questions just like the one you bring up the place a very powerful thing will probably be working in sincere good faith. I don?t know if finest practices have emerged round things like that, but I am positive that your job is clearly recognized as a good game. Each girls and boys feel the affect of just a second’s pleasure, for the rest of their lives.

  7. Chi Timone 说道:

    I think other web-site owners should take this website as an model – very clean and magnificent style and design, as well as the content. You are an expert in this topic!

  8. Mitchel Rabel 说道:

    I have observed that over the course of constructing a relationship with real estate entrepreneurs, you’ll be able to come to understand that, in every single real estate financial transaction, a commission amount is paid. In the end, FSBO sellers really don’t “save” the commission rate. Rather, they fight to earn the commission simply by doing a strong agent’s work. In the process, they commit their money and time to complete, as best they’re able to, the responsibilities of an agent. Those tasks include getting known the home via marketing, offering the home to willing buyers, building a sense of buyer desperation in order to induce an offer, preparing home inspections, taking on qualification inspections with the loan company, supervising fixes, and facilitating the closing of the deal.

  9. Golden Glahn 说道:

    Hi there dear, me plus my mother are also watch humorous movies however after I finished my homework

发表评论

电子邮件地址不会被公开。