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')
def initMainGraph(self):
print ('¤³¤³¤Ç¥á¥ó»Ãæ¤ò³õÆÚ»¯')
def outputChar(self, screen, imgRect):
oc = pygame.font.SysFont('Arial', 36)
str = 'Let\'s Start the Game'
wid = 100
hei = 300
for i in str:
surf = oc.render(i,0,fontColor)
rec = surf.get_rect()
wid += 20
rec.topleft = (wid, hei)
screen.blit(surf,rec)
pygame.display.flip()
time.sleep(0.25)
def slow(self, screen, imgRect):
print ('slow show')
def runGame():
pygame.init()
screen = pygame.display.set_mode(size)
bgimg = pygame.image.load('world.png').convert_alpha()#load bgImage
imgRect = bgimg.get_rect() #get the Area of the Image
screen.blit(bgimg,imgRect)
pygame.display.flip()
luxs = walk() #create a object
luxs.outputChar(screen, imgRect)
time.sleep(3)
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit(0)
runGame()
³õѧÕߣ¬×öÁËÒ»¸öСÀý×Ó£¬ÏÔʾ±³¾°Í¼ºÍÎı¾
Ïà¹ØÎĵµ£º
Python 3 ÊÇ Guido van Rossum ¹¦ÄÜÇ¿´óµÄͨÓñà³ÌÓïÑÔµÄ×îа汾¡£ËüËäÈ»´òÆÆÁËÓë 2.x °æ±¾µÄÏòºó¼æÈÝÐÔ£¬µ«È´ÇåÀíÁËijЩÓï·¨·½ÃæµÄÎÊÌâ¡£±¾ÎÄÊÇÕâ¸öÓÉÁ½²¿·Ö×é³ÉµÄϵÁÐÎÄÕÂÖеĵڶþƪ£¬±¾ÎĹ¹½¨ÔÚ´ËϵÁРǰһÆÚÎÄÕ µÄ»ù´¡Ö®ÉÏ£¬ÄÚÈݺ¸ÇÁË Python ¸ü¶àµÄÐÂÌØÐԺ͸ü¸ßÉîµÄһЩÖ÷Ì⣬±ÈÈçÔÚ³éÏó»ùÀà¡¢ÔªÀàºÍÐÞÊηûµÈ·½ÃæµÄ ......
×ªÔØ×Ô£ºhttp://purpen.javaeye.com/blog/98095
python Ö´ÐÐϵͳÃüÁî±È½Ï
¹Ø¼ü×Ö: python os system ϵͳÃüÁî
Ôڴ˱ȽÏÒ»ÏÂÁ½ÖÖ·½·¨Ö´ÐÐϵͳÃüÁîµÄ·½·¨,ÒÔ·½±ãÓÚÈÕºóÔËÓÃ:(
1. os.system()
system(command) -> exit_status
Execute the  ......
1.#£º×¢ÊÍ·û
2.±È½ÏÔËËã·û(»ù±¾ºÍJavaÀàËÆ)
< <= > >= == != <>
PythonĿǰ֧³ÖÁ½ÖÖ"²»µÈÓÚ"±È½ÏÔËËã·û£¬!=ºÍ<>£¬·Ö±ðÊÇC·ç¸ñºÍABC/Pascal·ç¸ñ¡£Ä¿Ç°ºóÕßÂýÂýµØ±»ÌÔÌÁË£¬
ÍÆ¼öʹÓÃǰÕß¡£
ÔÚPythonÖУ¬Ö§³Ö3<4<5ÕâÑùµÄ±í´ïʽ£¬¼ ......
PythonÖÐ×Ö·û´®±»¶¨ÒåΪÒýºÅÖ®¼äµÄ×Ö·û¼¯ºÏ¡£PythonÖ§³ÖʹÓóɶԵĵ¥ÒýºÅ»òË«ÒýºÅ£¬ÈýÒýºÅ°üº¬µÄ×Ö·û´®¡£
ʹÓÃË÷Òý²Ù×÷·û([])ºÍÇÐÆ¬²Ù×÷·û([:])¿ÉÒԵõ½×Ó×Ö·û´®¡£×Ö·û´®ÓÐÆäÌØÓеÄË÷Òý¹æÔò£ºµÚÒ»¸ö×Ö·ûµÄË÷ÒýÊÇ£°
£¬×îºóÒ»¸ö×Ö·ûµÄË÷ÒýÊÇ-1¡£
¼ÓºÅ(+)ÓÃÓÚ×Ö·û´®Á¬½ÓÔËË㣬ÐǺÅ(*)ÔòÓÃÓÚ×Ö·û´®Öظ´¡£ÈçÏÂÀý£º
pystr = " ......
[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, ......