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() À´¸Ä±äËæ»úÖÖ×Ó¡£¡£
Ïà¹ØÎĵµ£º
¹¤¾ßÀ¸->¸ß¼¶->ÅäÖÃ->±à¼Æ÷ÏÔʾ->Óï·¨¼ÓÁÁ->´ò¿ª
ÔÚ´ò¿ªµÄÎļþÖнáβ¼ÓÉÏÏÂÃæÎÄ×Ö£¬²¢±£´æ¡£
/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_] ......
write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
ÔÎÄÀ´×Ô£º¡¶JavaScript for C & Python programmers
¡·£¬¾¹ý×÷ÕßCanisÔÊÐíºó·Ò룬¼´Ê¹×ªÔØÇ븽´ø´ËÁ´½Ó¡£
ǰÑÔ£ººÜÉٸɷÒëµÄÊÂÇ飬ÀÛ£¬ÐÁ¿à£¬²»ÄÜ·¢»Ó£¬µäÐ͵ķÑÁ¦²»Ìֺã¬×î½üÎÞÁÄ£¬ÏëÔÚÍøÒ³ÉÏÏÔʾ¶¯»£¨ÒòΪCSDNÌ ......
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') ......
1£¬²»ÓÃÐÞ¸Ä/etc/vimϵÄvimrc¼°gvimrcÎļþ ¡£¡£¡£
2£¬ÔÚ~Ŀ¼Ï£¬Ð½¨Ò»¸ö.vimrcµÄÅäÖÃÎļþ¡£ÄÚÈÝÈçÏ£º£¨¸ßÁÁ£¬×Ô¶¯¶ÔÆë£¬×Ô¶¯Ëõ½ø£¬ÏÔʾÐкţ©
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Nov ......