Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Python 3 Êä³öÖØ¶¨ÏòʹÓÃC/C++

Python 3 Êä³öÖØ¶¨ÏòʹÓÃC/C++
By:gddsky
 
Ä¿±ê
Ï£Íû½«Python 3µÄÊä³öÖØ¶¨Ïòµ½×Ô¶¨ÒåµÄÊä³öÄ¿±ê¡£
 
ºËÐÄ
PythonʹÓÃsys.stdout¡¢sys.stderr×öÊä³öÄ¿±ê£¬Ö»ÒªÎÒÃÇÌæ»»ÕâÁ½¸öÖµ¾Í¿ÉÒÔÖØ¶¨Ïòµ½ÎÒÃÇ×Ô¶¨ÒåÄ¿±ê¡£Ìæ»»µÄÖµµÄ¹æÔòÔÚPythonµÄÎĵµÖÐsys (module)µÄsys.stdoutÉÏÃæËµÃ÷Ö»ÒªÌí¼ÓÒ»¸öwriteº¯Êý¾Í¿ÉÒÔÁË¡£ÏñÕâÑù£º
write(self, str)
ÎÒÃÇÖ»ÒªÔÚÕâ¸öº¯ÊýÀïÃæµ÷ÓÃÎÒÃÇ×Ô¼ºµÄÊä³öº¯Êý¾Í¿ÉÒÔʵÏÖ¸ÃÄ¿±êÁË¡£
 
·½°¸
ÔÚC++ÖÐдһ¸öPythonÄ£¿é£¬²¢µ¼Èë
ÔÚC++ÖÐÀûÓÃPyRun_SimpleString½¨Á¢Ò»¸öPyObjectÈ¥Ìæ»»Ô­Ê¼µÄsys.stdout¡¢sys.stderr
¸ã¶¨£¡£¡£¡
 
´úÂë
Ä£¿é¶¨Ò岿·Ö´úÂ루ÓÃpython demoϵÄÀý×Ó¸ÄдµÄ£©
static PyObject *console_write(PyObject *self, PyObject* args)
{
    if (s_pyConsoleNotify != NULL)
    {
        const char* pMsgString=0;
 
        if (!PyArg_ParseTuple( args, "s", &pMsgString ))
        {
            return NULL;
        }
        // ÎÒÃÇ×Ô¼ºµÄÊä³öº¯Êý
        myprint(pMsgString);
    }
 
    Py_INCREF( Py_None );
    return Py_None;
}
 
static PyMethodDef console_methods[] = {
    {"test",        console_test,   METH_NOARGS, "Return the meaning of everything."},
    {"write",   console_write,  METH_VARARGS, NULL},
    {NULL,      NULL}       /* sentinel */
};
 
static struct PyModuleDef consolemodule = {
    {}, /* m_base */
    "console_capi",  /* m_name */
    0,  /* m_doc */
    0,  /* m_size */
    console_methods, 


Ïà¹ØÎĵµ£º

×ÛºÏÔËÓÃCÓïÑÔÖ¸ÕëÇ¿ÖÆ×ª»»ºÍ»Øµ÷º¯Êý


  
ÔÚÕâ¸öÀý×ÓÀ»Øµ÷º¯Êý±È½ÏÁ½¸öÖµ¡£²éÕÒº¯ÊýÏò±È½Ïº¯Êý´«µÝÁ½¸öÖ¸ÏòÐèÒª½øÐбȽϵÄÖµµÄÖ¸Õ룬²¢¼ì²é±È½Ïº¯ÊýµÄ·µ»ØÖµ¡£ÀýÈ磺Áã±íʾÏàµÈµÄÖµ£¬ÏÖÔÚ²éÕÒº¯
Êý¾ÍÓëÀàÐÍÎ޹أ¬ÒòΪËü±¾Éí²¢²»Ö´ÐÐʵ¼ÊµÄ±È½Ï¡£È·Êµ£¬µ÷ÓÃÕß±ØÐë±àд±ØÐèµÄ±È½Ïº¯Êý£¬µ«ÕâÑù×öÊǺÜÈÝÒ׵ģ¬ÒòΪµ÷ÓÃÕßÖªµÀÁ´±íÖÐËù°üº¬µÄÖµµÄÀàÐÍ ......

¡¶CÓïÑÔÉî¶ÈÆÊÎö¡·Ñ§Ï°±Ê¼ÇÈý

1.10.3£¬voidÖ¸Õë
¡¾¹æÔò 1-35¡¿Ç§ÍòСÐÄÓÖСÐÄʹÓÃvoidÖ¸ÕëÀàÐÍ¡£
°´ÕÕ ANSI(American National Standards Institute)±ê×¼£¬²»ÄÜ¶Ô voidÖ¸Õë½øÐÐËã·¨²Ù×÷£¬¼´ÏÂÁвÙ×÷¶¼ÊDz»ºÏ·¨µÄ£º
void * pvoid;
pvoid++; //ANSI£º´íÎó
pvoid += 1; //ANSI£º´íÎó
ANSI ±ê×¼Ö®ËùÒÔÕâÑùÈ϶¨£¬ÊÇÒòΪËü¼á³Ö£º½øÐÐËã·¨²Ù×÷µÄÖ¸Õë±ØÐëÊ ......

Ì쳯Ҫ½«python¹ÙÍøÏÂÔØÒ³Ãæ·âµ½ºÎʱ£¿

¿É¶ñ¡¢¿É±¯¡¢¿É³Ü¡¢¿ÉÁ¯¡¢¿É̾¡¢¿ÉЦ£¡£¡£¡
2009Äê10ÔÂ15ÈÕ£¬Ò»¸öÁî¹ã´ópython±à³Ì¹¤×÷°®ºÃÕß¿ÞЦ²»µÃµÄÊ·¢ÉúÁË——pythonµÄ¹Ù·½ÍøÕ¾£¨http://www.python.org£©±»Î°´óµÄÌ쳯¸ø·âÁË£¡
µ±Ê±£¬ÓÐÈË˵ÊÇÒòΪÓÐÒ»¸öHÍøÕ¾ºÍpythonµÄ¹ÙÍøºÜÏñ£¬·â´íÁË¡£ÓÚÊÇ£¬ÎÒÊÔ×Å´ò¿ªÁËÄǸö“ÏàËÆµÄÍøÕ¾http://www.python.com ......

python¼òµ¥µÄ¿ÉÄæ¼ÓÃܳÌÐò

¼òµ¥¼ÓÃÜ£¬ÓÃpythonÀ´Ð´Ð´¡£
#coding=utf-8
'''
Description: ¿ÉÄæµÄ¼ÓÃÜÓë½âÃÜ
Environment: python2.5.x
Author:idehong@gmail.com
'''
import os
import sys
class Code(object):
'''¿ÉÄæµÄ¼ÓÃÜÓë½âÃÜ'''

def __init__(self, key = "idehong@gmail.com"):
self.__src_key ......

python ¶ÁдExcelÎļþ

http://sourceforge.net/projects/pyexcelerator/
12ÔÂ2ÈÕ
python ¶ÁдExcelÎļþ£¨×ªÌû limodou£©
http://www.lexicon.net/sjmachin/xlrd.htm
Õâ¸ö°üÊÇÓÃÀ´¶ÁExcelÎļþµÄ
ÔÚ·¢ÏÖ xlrd Ö®ºó²»¾Ã¾Í·¢ÏÖÁË pyExcelerator
£¬ËüÓë xlrd ²»Í¬£¬ËüÖ÷ÒªÊÇÓÃÀ´Ð´ Excel Îļþ£¬µ±È»¶ÁÒ²ÊÇûÓÐÎÊÌâµÄ¡£ÏÂÃæ¾ÍËüµÄʹÓüòµ¥µØ½éÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ