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

python ·ÖÐÎ


´úÂëÈçÏ£º
#!/usr/bin/env python
# -*-coding:UTF-8-*-#
from common import *
import Image, ImageFilter, math, sys, os, random
def modifyImageObj(img, matrix) :
    width, height = img.size   
   
    for h in range(0, height) :       
        for w in range(0, width) :
            pixel = matrix[h][w]
            img.putpixel((w, h), pixel)
    return img
def initMatrix(h, w, v = (0, 0, 0)) :
    result = []
    for _h in range(0, h) :
        row = []
        for _w in range(0, w) :
            row.append(v)
        result.append(row)
    return result
size = (600, 600)
img = Image.new('RGB', size)
h, w = size
matrix = initMatrix(h, w, (0, 0, 0))
m = []
m.append([-0.04, 0, -0.19, -0.47, -0.12, 0.3, 0.25])
m.append([0.65, 0, 0, 0.56, 0.06, 1.56, 0.25])
m.append([0.41, 0.46, -0.39, 0.61, 0.46, 0.4, 0.25])
m.append([0.52, -0.35, 0.25, 0.74, -0.48, 0.38, 0.25])
n = 0
x, y, a, b, c, d, e, f, newx, newy = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
while n < 300000 :
    r = random.uniform(0, 1)
    if r <= m[0][6] :
        a=m[0][0]
        b=m[0][1]
        c=m[0][2]
        d=m[0][3]
        e=m[0][4]
        f=m[0][5]
    elif r <= m[0][6] + m[1][6] :
        a=m[1][0]
   &nb


Ïà¹ØÎĵµ£º

python ÅжÏÊDz»ÊÇÖÐÎÄ×Ö

 ÏÂÃæÕâ¸öС¹¤¾ß°üº¬ÁË ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ÎÄ£¬»òÕ߯äËû×Ö·û¡£ È«½Ç·ûºÅת°ë½Ç·ûºÅ¡£ unicode×Ö·û´®¹éÒ»»¯µÈ¹¤×÷¡£ »¹ÓÐÒ»¸öÄÜ´¦Àí¶àÒô×ֵĺº×ÖתƴÒôµÄ³ÌÐò£¬»¹ÔÚÕûÀíÖС£
 
#!/usr/bin/env python
# -*- coding:GBK -*-
"""ºº×Ö´¦ÀíµÄ¹¤¾ß:
ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ ......

PythonµÄ´®¿ÚͨѶµÚÈý·½¿âPySerial

 ×î½üÒªÓõ½´®¿ÚͨѶ£¬¼òµ¥Ò×ÓõÄPythonÓÖ°ïÉÏæÁË£¬¶à¿÷ÁËÅÓ´óµÄµÚÈý·½×ÊÔ´~~~ £º£©
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and M ......

PythonÖеıàÂë


pythonÖеıàÂë
Ô­ÎÄ£ºhttp://users.ir-lab.org/~liulong/blog/archives/001962.html
¼ÆËã»úÒÔ0,1¶þ½øÖÆÎ»À´´æ´¢ÐÅÏ¢,ËùÒÔ×Ö·ûÔÚ¼ÆËã»úÖеıíʾҲÊǶþ½øÖÆÎ»,ÄÇÿ¸ö×Ö·ûËù¶ÔÓ¦µÄ¶þ½øÖÆÎ»ÊÇʲô,ÔÚ¿ªÊ¼µÄ¼ÆËã»úÖÐÒòΪֻ¿¼ÂÇÓ¢Óï, ËùÒÔ²»³¬¹ý256¸ö×Ö·û,¼´ÓÃÒ»¸ö×Ö½Ú(8bit)¾Í×ã¿ÉÒÔ±íʾËùÓеÄ×Ö·û,Õâ¸ö¶ÔÓ¦¹ØÏµ¾ÍÊǶÔ×Ö·ûµ ......

¶ÔpythonµÄisinstanceµÄÈÏʶ

>>> class objA:
...     pass
...
>>> A = objA()
>>> B = 'a','V'
>>> B
('a', 'V')
>>> C = 'a string'
>>> print instance(A,objA)
Traceback (most recent call last):
  File "<stdin>", line 1, in < ......

PythonÁ¬½ÓMySQL


°æÈ¨ÉùÃ÷
£º×ªÔØÊ±ÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂԭʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://mobile2008.blogbus.com/logs/28725962.html
 
°²×°ºÃÖ®ºó£¬Ä£¿éÃû×Ö½Ð×öMySQLdb £¬ÔÚWindowºÍLinux»·¾³Ï¶¼¿ÉÒÔʹÓã¬ÊÔÑéÁËÒ»ÏÂͦºÃÓã¬
²»¹ýÓÖ·¢ÏÖÁË·³È˵ÄÂÒÂéÎÊÌ⣬×îºóÓÃÁ˼¸¸ö°ì·¨£¬½â¾öÁË£¡
ÎÒÓÃÁËÏÂÃæ¼¸¸ö´ëÊ©£¬±£Ö¤MySQL ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ