Python基本语句

x = 1
y = 1

dataf = 1.0

def fun1():
    print("fun1")
    
    
class ClassB():
    def __init__(self):
        print("i am Class B")
        
    def ClassBFun1(self):
        print("i am class B fun1")    
    
class ClassA(ClassB):
    def __init__(self):
        print("i am ClassA")
        
    def ClassAFun1(self):
        print("I am ClassAfun1")
    


if __name__ == '__main__':

    print("main")
    
    #print("%d", x)
    
    print("His name is %s"%("wangtao"))
    print("He is %d years old"%(25))
    print("His height is %.2f"%(1.83))
    print("His height is %f"%(1.83))
    
    print("Name:%10s Age:%8d Height:%8.2f"%("wang", 25, 1.83))
    
    print("Name:%-10s Age:%08d Height:%08.2f"%("wang", 25, 1.83))
    
    #dataf = format(0.0015, '.2e')
    
    #print("%f"%(dataf))
    #print("His height is %.2f"%(dataf))
    
    
    
    fun1();
    
    classAa = ClassA();
    
    classAa.ClassAFun1();
    
    classAa.ClassBFun1();
    
    for i in range(100):
        print(i)
        

  

posted @ 2016-04-09 17:10  [无名]  阅读(477)  评论(0编辑  收藏  举报