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

Boost Python ʵÏÖCµ÷ÓÃpython´íÎó½â¾ö·½·¨

ÓÉÓÚBoost Python¸ú²»ÉÏPython°æ±¾¸üУ¬ÈçÏ·½·¨µ÷ÓÿÉÄܲúÉúTypeError: 'NoneType' object does not support item assignmentÒì³£¡£
Boost PythonÎĵµÖÐÀý×Ó¿ÉÄܲúÉúÒì³£¡£
Py_Initialize();
object main_module = import("__main__");
object main_dict = main_module.attr("__dict__");
try{
   object result = exec("result = 5 + 5",main_dict);
   int five_squared = extract<int>(main_dict["result"]);
   cout<<"extract value : "<<five_squared<<endl;
   cin>>ij;
}
    catch(error_already_set){
        PyErr_Print();
        cin>>ij;
    }
¿ÉÒÔÈçÏ·½·¨½â¾ö
Py_Initialize();
object main_module = import("__main__");
object main_dict = main_module.attr("__dict__");
try{
    handle<> ignored((PyRun_String(
        "result = 5 ** 2"
        , Py_file_input
        , main_dict.ptr()
        , main_dict.ptr())
    ));
   int five_squared = extract<int>(main_dict["result"]);
   cout<<"extract value : "<<five_squared<<endl;
   cin>>ij;
}
    catch(error_already_set){
        PyErr_Print();
        cin>>ij;
    }
Boost PythonÖÐÖ´Ðбí´ïʽº¯ÊýÒ²¿ÉÒÔÕý³£ÔËÐС£
Py_Initialize();
object main_module = import("__main__");
object main_dict = main_module.attr("__dict__");
try{
   object result = eval("5 + 5",main_dict);
   int five_squared = extract<int>(result);
   cout<<"extract value : "<<five_squared<<endl;
   cin>>ij;
}
    catch(error_already_set){
   


Ïà¹ØÎĵµ£º

pythonÖеÄÁбíÅÅÐò²Ù×÷

 
 
 
Python lists have a built-in sort() method that modifies the list in-place and a sorted() built-in function that builds a new sorted list from an iterable.
There are many ways to use them to sort data and there doesn't appear to be a single, central place in the various man ......

Python Socket ±à³Ì

client:
import socket, sys
if __name__ == '__main__':
    #´¦Àí²ÎÊý
    argv = sys.argv
    if (len(argv)!=3) or (len(argv)==2 and argv[1]=='/?'):
        print '>>>Useage:', argv[0], '<address> < ......

python PIL ÅúÁ¿´¦Àí´¦ÀíͼƬ

¿Í»§¸øÒ»¶ÑͼƬҪ´«µ½ºǫ́£¬Í¼Æ¬Ì«´óÁË£¬ÉϰÙÕÅͼÓÃphotoshop¸ÄÌ«Âý£¬¾ÍÏëµ½ÓÃpythonд¸ö¼òµ¥µÄÅú´¦Àí¡£¹¦Äܼòµ¥¾ÍÊǰÑԭͼ°´±ÈÀýËõС£¬´úÂë¸ü¼òµ¥ 20¶àÐС£
# -*- coding: cp936 -*-
import Image
import glob, os
#ͼƬÅú´¦Àí
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......

pythonµÄwiki ÁÐ×Ó.

#coding=utf-8
from newtest.wiki.models import WiKi
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response

def index(request, pagename=""):
"""ÏÔʾÕý³£Ò³Ã棬¶ÔÒ³ÃæµÄÎÄ×Ö×öÌØÊâµÄÁ´½Ó´¦Àí"""
......

ɾ³ýC/C++×¢ÊÍ

/********************************************************************
*ɾ³ýC/C++×¢ÊÍ
**********************************************************************/
#include <stdio.h>
//×¢Òâ
//1.¶Ô/****/µÄ´¦Àí
//2.Òª±£ÁôË«ÒýºÅÖ®¼äµÄÄÚÈÝ£¬Èçchar* test = "/*i am not comment */";
//3.¶ÔÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ