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

python random Ëæ»úµÄÎÊÌâ

ÔÚÒ»¸öÏîÄ¿ÖÐÐèÒª»ñÈ¡Ëæ»úÊý£¬Ë­ÖªµÀÓöµ½µãÎÊÌâ£ºËæ»úÊý²»Ëæ»ú¡£ËùÒÔÎÒдÁ˸ö¼òµ¥Ô­ÐÍ¡£¿´Ïµ½µ×ÊÇɶÎÊÌâ¡£
import os,random,sys,time
while True:
father = os.fork()
if father:
time.sleep(2)
rd = 7
else:
#random.seed()
rd = random.choice([2,3,4,5])
print rd
time.sleep(2)
sys.exit(0)

´úÂë»ù±¾¾ÍÕâÑù¡£Ë­ÖªµÀÔÚ×Ó½ø³ÌÀïÃæ´òÓ¡µÄ random  ²»Æð×÷Óá£Ã¿´ÎËæ»úÊý¶¼ÊÇÒ»ÑùµÄ¡£
²âÊÔ·¢ÏÖ¡£ÊÇ while ³öÏÖÎÊÌ⣬ÒòΪwhile һֱѭ»·£¬¶øËæ»úÖÖ×Ó£¬ÊÇÔÚµÚÒ»´Î import random µÄʱºò¾ÍÒѾ­ÖÖÏÂÁË¡£ËùÒÔµ¼ÖÂËæ»úÊýÒ»Ö±¶¼²»»á±ä»¯~~~  º¹¡£Ó×ÖÉÎÊÌâµ¼ÖÂÀ˷Ѻܶàʱ¼ä
¿´random.seedÊÖ²á½âÊÍ£º
If x is omitted or None, current system time is used; current system time is also used to initialize the generator when the module is first imported.
Ã÷°×ÁË¡£×îºóÓà random.seed() À´¸Ä±äËæ»úÖÖ×Ó¡£¡£


Ïà¹ØÎĵµ£º

UltraEdit¶ÔPythonµÄ¸ßÁÁÏÔʾ

¹¤¾ßÀ¸->¸ß¼¶->ÅäÖÃ->±à¼­Æ÷ÏÔʾ->Óï·¨¼ÓÁÁ->´ò¿ª
ÔÚ´ò¿ªµÄÎļþÖнáβ¼ÓÉÏÏÂÃæÎÄ×Ö£¬²¢±£´æ¡£
/L10"Python" Line Comment = # Block Comment One = """ Block Comment Off = """ Escape Char = \ File Extensions = PY PYW
/Indent Strings = ":"
/Function String 1 = "%[ ,^t]++def[ ]+^([a-zA-Z0-9_] ......

CºÍPython³ÌÐòÔ±µÄJavaScriptѧϰָÄÏ£¨Ò룩


write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
 Ô­ÎÄÀ´×Ô£º¡¶JavaScript for C & Python programmers
¡·£¬¾­¹ý×÷ÕßCanisÔÊÐíºó·­Ò룬¼´Ê¹×ªÔØÇ븽´ø´ËÁ´½Ó¡£

ǰÑÔ£ººÜÉٸɷ­ÒëµÄÊÂÇ飬ÀÛ£¬ÐÁ¿à£¬²»ÄÜ·¢»Ó£¬µäÐ͵ķÑÁ¦²»Ìֺã¬×î½üÎÞÁÄ£¬ÏëÔÚÍøÒ³ÉÏÏÔʾ¶¯»­£¨ÒòΪCSDNÌ ......

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') ......

ÎÒµÄVIMÅäÖÃ(ubuntu+python)

1£¬²»ÓÃÐÞ¸Ä/etc/vimϵÄvimrc¼°gvimrcÎļþ ¡£¡£¡£
      2£¬ÔÚ~Ŀ¼Ï£¬Ð½¨Ò»¸ö.vimrcµÄÅäÖÃÎļþ¡£ÄÚÈÝÈçÏ£º£¨¸ßÁÁ£¬×Ô¶¯¶ÔÆë£¬×Ô¶¯Ëõ½ø£¬ÏÔʾÐкţ©
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Nov ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ