月份:2015年8月
Some flowchart
Python Snippets(3)
1.
*attr()
class myClass(object):
def __init__(self):
self.foo = 100
myInst = myClass()
print hasattr(myInst, 'foo')
print getattr(myInst, 'foo')
print hasattr(myInst, 'bar')
#print getattr(myInst, 'bar')
print getattr(myInst, 'bar', 'oooops')
setattr(myInst, 'bar', 'my attr')
print getattr(myInst,'bar')
print dir(myInst)
print getattr(myInst,'bar')
delattr(myInst, 'foo')
print dir(myInst)
2.
字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode[……]
Some pieces of song or Albums.
All of the music below that you can find in Netease Music.
1.
星空下的钢琴曲 by 张宇桦
夜的钢琴曲 by
Python snippets (2)
1.
Generators
def simpleGen():
yield 1
yield '2--->punch!'
myG = simpleGen()
'''
myG.next()
myG.next()
myG.next() #Exception
'''
for eachItem in simpleGen():
print eachItem,
print '-----------------------------------------'
from random import randrange
def randGen(aList):
while len(aList) > 0:
yield aList.pop(randrange(len(aList)))# Just like list.pop() and random.choice()
for item in randGen(['rock', 'paper', 'scissors']):
print item
2.
import longmodulename
short = longmodulename
del longmodulename
from cgi import FieldStorage as form
3.
1677241673[……]
宋之韵
《宋之韵》文字解说词
第一集 宋词概览
一说宋词,我们立刻就会想到晏殊的,无可奈何花落去,似曾相识燕归来。想到欧阳修的,人生自是有情痴,此事不关风与月。想到晏几道的,今宵剩把银釭照,犹[……]
唐之韵
唐之韵解说词
第一集 千古唐诗
这是陕西醴泉县的昭陵,埋在这里的是中国历史上最为杰出的皇帝——唐太宗李世民。李世民,这个少年英雄,十九岁起兵反隋,骑着这昭陵六骏,手握风[……]
唐寅生平及诗词
唐寅(1470—1523),字伯虎,一字子畏,号六如居士、桃花庵主、鲁国唐生、逃禅仙吏等,据传于明宪宗成化六年庚寅年寅月寅日寅时生,故名唐寅。汉族,吴县(今江苏苏州)人。他玩世不恭而又才气横溢,诗文擅[……]
Python snippets (1)
1.
Keywords—>with
with open('/etc/passwd','r') as f:
for eachLine in f:
print eachLine,
2.
Provide one parameter to assert
16772416[……]
python: pymssql
http://www.pymssql.org/en/latest/pymssql_examples.html
The following examples come from the link[……]