[python-chinese] python25_d生成的有问题?如何解决的!附源代码
Bright Lee
m2lihui在163.com
星期五 八月 3 11:00:25 HKT 2007
Á½¸ö²âÊÔ´úÂ룬һ¸öÊÇ cxxusepy.cpp ,Ò»¸öÊÇpy½Å±¾µÄ
// cxxusepy.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£
//
#include "stdafx.h"
#include <python.h>
int _tmain(int argc, _TCHAR* argv[])
{
Py_Initialize();
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * pArg = NULL;
pModule = PyImport_ImportModule("test2");
pFunc = PyObject_GetAttrString(pModule, "Hello");
pArg = Py_BuildValue("(s)", "http://www.google.com");
PyEval_CallObject(pFunc, pArg);
Py_Finalize();
return 0;
}
#Filename test2.py
#!/usr/bin/env python
# Obtain Web Page - Chapter 6 - dump_page.py
import sys, urllib2
def Hello(s):
print "Hello, world!"
print s
def DumpPage(url):
req = urllib2.Request(url)
fd = urllib2.urlopen(req)
while 1:
data = fd.read(1024)
if not len(data):
break
sys.stdout.write(data)
ÔÚʹÓõ÷ÊԵĶ¯Ì¬¿â£¨python25_d.dll£©Ê±
£Ð£ùÎļþÖУ¬Èç¹ûÈ¥µôimport sys, urllib2¼°DumpPageº¯Êý¾ÍÄܳɹ¦£¿²»È»pModule = PyImport_ImportModule("test2");
µÄ·µ»ØÖµÎª¿Õ
ʹÓãңå£ì£å£á£ó£å£¨python25.dll£©µÄ¿âʱûÓÐÎÊÌâ
----- Original Message -----
From: Robert Chen
To: python-chinese在lists.python.cn
Sent: Thursday, August 02, 2007 8:46 PM
Subject: Re: [python-chinese]python25_dÉú³ÉµÄÓÐÎÊÌ⣿ÈçºÎ½â¾öµÄ£¡
"·¢ÏÖ²»ÖÐÁ½¸öÄ£¿é¼ÓÔØ¶¼»áʧ°Ü"
Õâµ½µ×ÊÇɶÒâ˼°¡
On 8/2/07, Bright Lee <m2lihui在163.com> wrote:
×Ô¼ºÏµÄÔ´´úÂë±àÒëµÄpython25_d.dllÓÐÎÊÌâ
ÔÚµ÷Ê԰汾ʱ£¬·¢ÏÖ²»ÖÐÁ½¸öÄ£¿é¼ÓÔØ¶¼»áʧ°Ü£®
ºóÀ´ÔÚÓãңå£ì£å£á£ó£å°æ±¾¾ÍûÓÐÎÊÌâÁË£¬ÓõÄpython25.dll¾ÍûÓÐÎÊÌ⣬£×£è£ù£¿
_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
--
Robert
¹Ø×¢Python ¹Ø×¢ËÑË÷
Dynamic Life¡ª¡ªhttp://blog.csdn.net/balabalamerobert
------------------------------------------------------------------------------
_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070803/11c0e511/attachment.html
关于邮件列表 python-chinese 的更多信息