python之娱乐类:魔法传值
还记得是一个月的事情,神奇般的在youtube上搜索python,有个老外的教程里面有这么个内容:
#=============================
## python 魔法传值
#=============================
#-*-coding:utf-8-*-
class sono:
def Dict(self,**args):
return args
def Tuple(self,*args):
return args
if __name__ == "__main__":
inst = sono()
dic = inst.Dict(a=1,b=2)
tple = inst.Tuple(1,2)
print dic,tple
有趣的传值(**args) 可以返回字典 就是对输入的数据比较严格 需要 A:X 形式
相关文档:
#快速排序
def Partition(mylist, low, high):
tmp = mylist[low]
while low < high:
while low < high and mylist[high] >= tmp:
high = high - 1
if low < high:
mylist[low] = mylist[high]
low = low + 1
while low < hi ......
情景一:
在文件夹里有六十多个RM格式的视频文件,我现在需要把它们的文件名都提取出来,并去掉文件的扩展名,以便放到需要的网页里。
应该有什么软件可以完成这个简单的要求,可是一时间到哪里去找这 样一个符合要求的软件呢?总不能手工完成把。在Linux上用强大的shell脚本应该也可以完成,可是使用Windows的朋友呢?其 ......
#使用类
class CPerson:
#类变量好比C++中的静态成员变量
population = 0
def SayHi(self):
print('Hello World')
def HowMany(self):
if CPerson.population == 1:
print('I am the only person here.')
else:
print(('We have %d perso ......
1. Building an Application with PyGTK and Glade
2. Creating a GUI using PyGTK and Glade
3. A Beginner's Guide to Using pyGTK and Glade
4. Is there a walkthrough on getting PyGTK2 and libglade2 to work on win32 ......