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

python Ö® pilÉú³ÉÑéÖ¤ÂëͼƬ

#!/usr/bin/python
#coding=utf-8
import Image,ImageDraw,ImageFont,os,string,random,ImageFilter
def initChars():
"""
ÔÊÐíµÄ×Ö·û¼¯ºÏ£¬³õʼ¼¯ºÏΪÊý×Ö¡¢´óСд×Öĸ
usage: initChars()
param: None
return: list
·µ»ØÔÊÐíµÄ×Ö·û¼¯ºÍ
for: picCheckerÀà³õʼ×Ö·û¼¯ºÏ
todo: Nothing
"""
nums = [str(i) for i in range(10)]
letterCase = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k',
'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y'
]
upperCase = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y'
]
return(nums+letterCase+upperCase)

class picChecker():
"""
ͼƬÑéÖ¤´úÂ룺
1) Óû§×¢²áÐèÌîдͼƬÑéÖ¤Â룬ÒÔ×èÖ¹»úÆ÷ÈË×¢²á
2) ͼƬÑéÖ¤Âë×Ö·ûÊýΪ 4 λ(´óСд×ÖĸÓëÊý×Ö£¬²»Çø·Ö´óСд)¡£
Óû§Èç¹ûûÓÐÌîдÑéÖ¤Âë»òûÓÐÌîдÕýÈ·µÄÑéÖ¤Â룬
Ò³ÃæÓѺÃÐÔÌáʾÓû§Ìîд(ͬʱ³ÌÐò·½ÃæÒ²×öÏàÓ¦ÏÞÖÆ)
usage: pc = picChecker().createChecker()
param: ºÜ¶à£¬ÈçÏÂ
chars ÔÊÐíµÄ×Ö·û¼¯ºÏ£¬
ÀàÐÍ list
ĬÈÏÖµ initChars()
Àý×Ó ['1','2','3']
length ×Ö·û´®³¤¶È
ÀàÐÍ integer
ĬÈÏÖµ 4
size ͼƬ´óС
ÀàÐÍ tutle
ĬÈÏÖµ (120,30)
Àý×Ó (120,30)
fontsize ×ÖÌå´óС
ÀàÐÍ integer
ĬÈÏÖµ 25
begin ×Ö·ûÆäʵλÖ㬼´×óÉϽÇλÖÃ
ÀàÐÍ tutle
ĬÈÏÖµ (5,-2)
outputType Êä³öÀàÐÍ
ÀàÐÍ string
ĬÈÏÖµ GIF
¿Éѡֵ GIF JPEG TIFF PNG
mode ͼƬģʽ
ÀàÐÍ string
¿Éѡֵ RGB L (»¹ÓÐÆäËûģʽ£¬µ«Ö»ÍƼöÕâ2ÖÖ)
ĬÈÏÖµ RGB
backgroundColor ±³¾°É«
foregroundColor ǰ¾°É«
µ±mode=RGBʱ£¬backgroundColor,foregroundColorΪtutleÀàÐÍ
ȡֵΪ(integer,integer,integer)
±íʾRGBÑÕɫֵ
µ±mode=Lʱ£¬backgroundColor,foregroundColorΪÊý×Ö£¬±íʾºÚ°×ģʽ
ȡֵΪ0-255
±íʾ»Ò¶È
fonttype ×ÖÌå·¾¶
ÀàÐÍ string
ĬÈÏÖµ "simsum.ttc"
jamNum ¸ÉÈÅÏßÌõÊý
ÀàÐÍ (int1,int1)
int1 ¸ÉÈÅÏßÌõÊýÏÂÏÞ£¬°üº¬
int2 ¸ÉÈÅÏßÌõÊý


Ïà¹ØÎĵµ£º

PythonµÄ²Ù×÷·û

1.#£º×¢ÊÍ·û
2.±È½ÏÔËËã·û(»ù±¾ºÍJavaÀàËÆ)
<  <=  >  >=   ==   !=   <>
PythonĿǰ֧³ÖÁ½ÖÖ"²»µÈÓÚ"±È½ÏÔËËã·û£¬!=ºÍ<>£¬·Ö±ðÊÇC·ç¸ñºÍABC/Pascal·ç¸ñ¡£Ä¿Ç°ºóÕßÂýÂýµØ±»ÌÔÌ­ÁË£¬
ÍÆ¼öʹÓÃǰÕß¡£
ÔÚPythonÖУ¬Ö§³Ö3<4<5ÕâÑùµÄ±í´ïʽ£¬¼ ......

PythonºÍRubyµÄ¶Ô±È£¬¾ÀÕýһЩÎó½â

PythonºÍRubyµÄ¶Ô±È£¬¾ÀÕýһЩÎó½â
ÏÂÃæÊÇÎÒÔÚ¿´Á½Æª¹ØÓÚPythonºÍRuby¶Ô±ÈµÄÎÄÕÂʱ£¬Ëù×÷µÄ¾ÀÕý£¬Ô­ÎͼÊǹ㷺Á÷Ðеģ¬±È½ÏºÃÕÒ¡£
------------------------------------------------------
¡¶rubyºÍpythonµÄ±È½Ï¡·¸üÕýÒ»µãÊÂÇé
1¡¢Îĵµ¡¢¿ªÔ´ÏîÄ¿¡¢¿âÖ§³Ö£¬ÕâЩ¶«Î÷Ruby²»Òª¸úPython±È£¬²»ÊǼ¸¸öÊýÁ¿¼¶µÄÎÊÌ⣬ºÎ±ØÃ²Ë ......

python mysqlµ¼ÈëÊý¾Ý

[root@pku-fan MySQL]# cat limbs.sql
CREATE DATABASE cookbook;
USE cookbook;
DROP TABLE IF EXISTS limbs;
CREATE TABLE limbs
(
    thing   VARCHAR(20),    # what the thing is
    legs    INT,     ......

Python ÓÎÏ·³õѧ

import sys, pygame, time
size = width, height = 700,700
fontColor = (0,0,255)
class walk:
'''This is a game about war.
Just like war 3.'''
def __init__(self):
'''Init the screen.
Get param and init the screen'''

#print ('this is init funnction') ......

pythonʵÏÖtwitter client

¹«Ë¾µÄ´úÀí¿ÉÒÔÖ±½Ó´©Ç½£¬×ÔÓÉ·ÃÎÊTwitter¡¢FacebookµÈÍøÕ¾£¬ÕâÁ½ÌìÑо¿ÁËÒ»ÏÂTwitterÌṩµÄAPI£¬ÓÃpythonдÁËÒ»¸ötwitter client£¬Ö»ÊµÏÖÁË»ù±¾¹¦ÄÜ£¬²é¿´×Ô¼ºµÄtwitterÏûÏ¢£¬Ò²¿ÉÒÔ²»ÑéÖ¤£¬²é¿´publicµÄtwitterÏûÏ¢¡£ÆäËû¹¦ÄÜʵÏÖÀàËÆ¡£Ö÷Òªº¯ÊýÈçÏ£º
def fetch_with_proxy(proxy, username, password, url):
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ