Source

wd_pys60 / metxt.py

# -*- coding: utf-8 -*-  
__author__= " weakdancer@gmail.com "  
def P (*w):
    print  "|".join(w)
def do (func,n,*args):
    if  args:
        exec ( "func %s \n" % str(args)*n) 
    else:
        exec ( "func() \n " *n) 

#do(P, 3 , "hello" ,"man","gao")
def sum(li):
    result=0
    for i in li:
        result+=i
    return result
def sum_pow(*args):
    return sum([num**2 for num in args])
#print sum_pow(1,2,3,5.5)

class m:
    def __init__(self,body):
        self.body=body
        self.x=len(body[0])
        self.y=len(body)
        self.p()
    def p(self):
        print repr(self.body)
    def zz(self):
        nbody=[]
        for x in range(self.x):
            nbody.append([])
            for y in range(self.y):
                nbody[x].append(self.body[y][x])
        self.body=nbody
        

B=[[1,2,3],
    [1,2,3],
    [1,2,3],
    [1,2,3],]
M=m(B)
M.zz()