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

²ÂÊý×Ö——Python°æ

ÖÕÓÚÍêÁ˸ßһʱһ¸öССµÄÔ¸Íû£¬Ð´Ò»¸ö²ÂÊý×ÖµÄСÓÎÏ·£¡

Ï×ÉÏÔ´´úÂ룡

Python code:

#! /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


Ïà¹ØÎÊ´ð£º

Python + Tkinter ´°¿ÚËõ·ÅÎÊÌâ

ѧϰÓÃpython+tkдÁËÒ»¸ö¼òµ¥½Å±¾£¬ÓÃÀ´ÏÔʾһЩͼƬºÍÆä˵Ã÷£¬Éè¼Æ2¸ö°´Å¥À´·­Ò³¡£¿Ø¼þ²ÉÓÃpack()·½Ê½£¬Ö÷´°¿ÚûÓÐÌرðÖ¸¶¨³ß´ç£¬°´Ï·­Ò³°´Å¥ºóÄÜ×Ô¶¯ÒÀ¾ÝÄÚÈÝ×Ô¶¯Ëõ·Å´óС£¬ÈçÔ¤ÆÚÉèÏë¡£²»¹ý±È½ÏÆæ¹ÖµÄÊÇ,Èç¹ûÓÃÊ ......

PythonÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯

±¾ÎÄÕª×Ô¡¶¿É°®µÄPython¡·¡°¹âÅ̹ÊÊ¡±CDay-1 ʵÓû¯ÖÐÎÄ¡£
[img]http://t.douban.com/mpic/s3901817.jpg[/img]
CDay-1 ʵÓû¯ÖÐÎÄÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯
ÄãÅöµ½99%µÄÎÊÌ⣬ÆäËûÈË֮ǰÒѾ­Óöµ½¹ýÁË£¬Ë ......

python dict µÄÄÚ´æ¿ØÖÆ

ϱßÊÇÎÒдµÄÒ»¶Î´úÂ룬Ëæ»úÉú³É100ÍòÌõ4ÁÐÊý¾Ý£¬²¢·Åµ½dictÀï±ß£¬È»ºó°ÑÄÚÈÝдµ½txtÎļþÖÐ

Python code:

#!/usr/bin/python2.5
import random
import time
time.sleep(5)
shapes = {}
print " ......

boost.python c++ǶÈëpythonÈçºÎÖØÔØ=£¿

ÎÒÏÖÔÚÓÐÒ»¸öÐèÇóÊÇÕâÑùµÄ
ÎÒÓÐ2¸öÀà
class A
{
public:
int val;
}

class B
{
public:
A a
}

ÏÖÔÚÔڽű¾ÖÐÖ»ÄÜ
b.a.val = 1
ÎÒÔÚpythonÖÐÏëʹÓÃ
b.a = 1
......

python»ù´¡ÎÊÌ⣬Çë½Ì¸ßÊÖ¡£

ÇëÎʸßÊÖ£¬ÎÒÓõÄÊÇpythonwin2.5µÄ°æ±¾£¬ÔÚ¿ª·¢µÄ¹ý³ÌÖÐÓöµ½ÁËÏÔʾÖÐÎÄÂÒÂëµÄÎÊÌâºÜÍ·ÌÛ£¬Çë¸ßÊִͽ̡£
¼òµ¥µÄ´úÂëÈçÏ£¬±£´æµÄÎļþÃûÊÇÓ¢Îĵģ¬ÎÒÊÇÓÃpythonwinн¨µÄ½Å±¾£¬±£´æµÄʱºòÑ¡ÏîÀïûÓбàÂëÑ¡ÏÔËÐк ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ