02 2017 档案
摘要:#!/usr/bin/env python# coding=utf-8 __metaclass__ = type class StaticMethod: @staticmethod def foo(): print "This is static method foo()." class Class
阅读全文
摘要:编程实现:a[0]*b[0] + a[1]*b[1] +...+a[i]*b[j] >>> a=[1,2,3,4,5]>>> b=[6,7,8,9,0] >>> from functools import reduce>>> from operator import add,mul>>> reduc
阅读全文
摘要:>>>def foo(x,y,z,*args,**kargs): print x print y print z print args print kargs >>> foo(1,2,3,4,5,name="qiwsir",age=37) 1 2 3 (4, 5) {'name': 'qiwsir'
阅读全文
摘要:#!/usr/bin/env python # coding=utf-8
阅读全文
摘要:>>> myinfor = {"name":"qiwsir","site":"qiwsir.github.io","lang":"python"} >>> dict(zip(myinfor.values(),myinfor.keys())) { 'qiwsir': 'name', 'python':
阅读全文
摘要:>>> a = [1,2,3,4,5] >>> b = [9,8,7,6,5] >>> length = len(a) if len(a)<len(b) else len(b) >>> length 5 >>> c = zip(a,b) >>> c [(1, 9), (2, 8), (3, 7),
阅读全文

浙公网安备 33010602011771号