摘要:
1.Python Helloworld! #!/usr/bin/env pythonprint "Hello World!!!" 2.Python 基本变量命名 合法变量: Name='freeman' NameInfo ='freeman' 不合法变量: name-info = 'freeman' 阅读全文
posted @ 2016-04-08 20:35
FreeMan1
阅读(256)
评论(0)
推荐(0)
摘要:
import res='hello world'a=re.match('h.*',s)print a.group()a=re.search('e.*',s)print(a.group())a=re.findall('l.',s)print aa=re.split("l",s)print aa=re. 阅读全文
posted @ 2016-04-08 15:02
FreeMan1
阅读(265)
评论(0)
推荐(0)
摘要:
def diedai (number): product=1 for i in range(number): product=product*(i+1) print 'iii',i print product return productc=diedai(number=int(raw_input(' 阅读全文
posted @ 2016-04-08 14:59
FreeMan1
阅读(257)
评论(0)
推荐(0)
摘要:
import random#print random.randint(1,3)#print random.randrange(1,10,2)def chek_code(): checkcode= '' for i in range(6): current=random.randrange(0,6) 阅读全文
posted @ 2016-04-08 14:58
FreeMan1
阅读(162)
评论(0)
推荐(0)
摘要:
def sayhi(): seek = 0 while True : with open('test.txt','r') as f : f.seek(seek) data = f.readline() if data: seek = f.tell() #yield data yield data e 阅读全文
posted @ 2016-04-08 14:56
FreeMan1
阅读(135)
评论(0)
推荐(0)
摘要:
def abc(test): print "hello %s"%testabc("brid")def say (a,*args): print a, argssay("hello","zha","ab")def say (a,**args): print a, argssay ("hello",na 阅读全文
posted @ 2016-04-08 14:14
FreeMan1
阅读(179)
评论(0)
推荐(0)
摘要:
class myexception(Exception): def __init__(self,value): self.value = value self.message ='myexception error'def say(): #name='FreeMan' try: raise myex 阅读全文
posted @ 2016-04-08 14:12
FreeMan1
阅读(157)
评论(0)
推荐(0)
摘要:
反射 代码示例:person.pydef run (a): print 'running %s'%adef eat(): print 'eating'def talk(): print 'taliking'player.py import persondef play(action): return 阅读全文
posted @ 2016-04-08 14:12
FreeMan1
阅读(161)
评论(0)
推荐(0)
摘要:
import timedef hh(func): def wrapper(*args, **kwargs): start=time.clock() func(*args, **kwargs) end=time.clock() print 'time:%f'%(end - start) return 阅读全文
posted @ 2016-04-08 14:09
FreeMan1
阅读(179)
评论(0)
推荐(0)

浙公网安备 33010602011771号