²ÂÊý×Ö——Python°æ
Õâ¸öÊÇ1.10°æ±¾µÄ²ÂÊý×Ö£¬ËäÈ»´úÂë»ù±¾²»±ä£¬µ«ÊDZäµÄÊÇ˼ά·½Ê½£¬²»ÔÙÊÇÓÃÃæÏò¹ý³ÌµÄ·½·¨£¬¶ø¸ÃΪÓÃÀàÀ´ÊµÏÖ£¬±È½ÏÇ°ºóµÄ´úÂ룬ÕâÒ»¸ö¼ò½à¶àÁË£¬¶øÇÒ¸üÈÝÒ×Àí½â£¡
¸üУº
#1.0°æ±¾ÖеÄÌáʾÀàÐÍÊÇ£ºAABB£¬¼òµ¥µÄ˵¾ÍÊÇÏà¶ÔλÖõÄÊý×Ö¶ÔÁ˾ÍÏÔʾA£¬´íÁ˾ÍÏÔʾB£»
#ÏÖÔÚµÄÌáʾ¸ÄΪ£º0A4B¸ñʽ£¬Ò²¾ÍÊÇ˵²»ÌáʾÄǸöλÖõÄÊý×ÖÊÇÕýÈ·µÄ£¬¼Ó´óÁËÓÎÏ·ÄѶȣ¡
¼Æ»®£º
½ÓÏÂÀ´µÄÄ¿±êÊÇÓÃwxPython »òtk¸øÕâ¸öСÓÎÏ·Ôö¼ÓUI£¬Í¬Ê±Ê¹Õâ¸öÓÎÏ·µÄ¿ÉÒÔ×ÔÓɵ÷ÕûÄѶȣ¡
#! /usr/bin/env python
# -*- coding:gb2312 -*-
import random
class game:
def __init__(self):
self.nub = 5 #¿ØÖÆÉú³ÉµÄËæ»úÊýλÊý£¬Î»ÊýΪnub-1
self.number = 0 #³õʼ»¯Ëæ»úÊý
self.comparer = "" #³õʼ»¯ Ìáʾ
self.limit = 9 #¿ØÖÆÿ¾ÖÓÎÏ·»ú»á
def run(self): #³ÌÐò¿ªÊ¼
go = raw_input("ÇëÊäÈë(1)¿ªÊ¼ÓÎÏ·£º")
if int(go)==1:
self.main()
def main(self): #Ö÷³ÌÐò
self.getnumber()
a = "ÇëÊäÈë"+str(self.nub-1)+"λµÄÕûÊý:"
intstr = ""
count = 0
while intstr!="999999":
intstr = raw_input(a)
if (len(intstr) < (self.nub-1)) or (len(intstr)>(self.nub-1)):
print "ÓÎÏ·ÖØпªÊ¼£¬ÇëÊäÈë"+str(self.nub-1)+"λÕûÊý£¡"
count = 0
continue
if intstr == self.number:
print "Äã²Â¶ÔÁË£¡"
break
self.compare(intstr,self.number)
print "Äã²Â´íÁË£¬Ìáʾ£º" + self.comparer
count +=1
if count >= self.limit:
print "³¬¹ýÏÞ¶¨´ÎÊý£¬ÓÎÏ·½áÊø£¡ "
print "ÕýÈ·´ð°¸ÊÇ£º"+ self.number
break
self.run()
def getnumber(self): #»ñÈ¡Ëæ»úÊýµÄÀà·½·¨
a = [0,1,2,3,4,5,6,7,8,9]
i = ""
n = 10
while 1:
b = random.randrange(0,n)
i = i + str(a[b])
del a
Ïà¹ØÎĵµ£º
ÕâƪÎÄÕ½²µÃ±È½ÏÇå³þpythonµÄ×Ö·û´®±àÂëÎÊÌâ
ÔÎijö´¦:http://hi.baidu.com/yobin/blog/item/894158b575090dcb37d3ca07.html
------------------------------------------------------------------
×Ö·û´®±àÂë
pythonÖÐĬÈϱàÂëÊÇASCII£¬¿ÉÒÔͨ¹ýÒÔÏ·½Ê½ÉèÖúͻñÈ¡£º
import sys
print sys.getdefa ......
Google½«ÏÞÖÆPythonÓïÑÔµÄÓ¦Óà ¿ª·¢ÉçÇøÈÈÒé
¸ÐлÂ̲ÝÐÇ¿ÕµÄͶµÝ
ÐÂÎÅÀ´Ô´:CSDN
Collin WinterÊÇPythonÉçÇøһλÆľßÓ°ÏìÁ¦µÄ¿ª·¢Õߣ¬ËûÔøÊÇCPythonÏîÄ¿µÄºËÐÄ¿ª·¢ÕßÖ®Ò»¡¢Ò²ÔøÊÇUnladen Swallow£¨¼ûÎÄĩעÊÍ£©µÄºËÐÄ¿ª·¢Õߣ¬²ÎÓëÁ˺ܶàPythonÏîÄ¿µÄ¿ª·¢¡£½üÀ´´«ÎÅGoogle½«ÔÚÆäÐÂÏîÄ¿ÖÐÏÞÖÆPythonµÄʹÓã¬Îª´ËÓп ......
>>> 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ºÍC·Ö±ðÓÐן÷×ÔµÄÓÅȱµã£¬ÓÃPython¿ª·¢³ÌÐòËٶȿ죬¿É¿¿ÐԸߣ¬²¢ÇÒÓÐÐí¶àÏÖ³ÉÄ£¿é¿É¹©Ê¹Ó㬵«Ö´ÐÐËÙ¶ÈÏà¶Ô½ÏÂý£»CÓïÑÔÔòÕýºÃÏà·´£¬ÆäÖ´ÐÐËٶȿ죬µ«¿ª·¢Ð§Âʵ͡£ÎªÁ˳ä·ÖÀûÓÃÁ½ÖÖÓïÑÔ¸÷×ÔµÄÓŵ㣬±È½ÏºÃµÄ×ö·¨ÊÇÓÃPython¿ª·¢Õû¸öÈí¼þ¿ò¼Ü£¬¶øÓÃCÓïÑÔʵÏÖÆä¹Ø¼üÄ£¿é¡£±¾ÎĽéÉÜÈçºÎÀûÓÃCÓïÑÔÀ´À©Õ¹PythonµÄ¹¦ ......
°æȨÉùÃ÷
£º×ªÔØʱÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://mobile2008.blogbus.com/logs/28725962.html
°²×°ºÃÖ®ºó£¬Ä£¿éÃû×Ö½Ð×öMySQLdb £¬ÔÚWindowºÍLinux»·¾³Ï¶¼¿ÉÒÔʹÓã¬ÊÔÑéÁËÒ»ÏÂͦºÃÓã¬
²»¹ýÓÖ·¢ÏÖÁË·³È˵ÄÂÒÂéÎÊÌ⣬×îºóÓÃÁ˼¸¸ö°ì·¨£¬½â¾öÁË£¡
ÎÒÓÃÁËÏÂÃ漸¸ö´ëÊ©£¬±£Ö¤MySQL ......