Python基本语句
2016-04-09 17:10
513 查看
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)
相关文章推荐
- Python 练习实例10
- 我的Python学习之路之基本语法-面向对象编程
- 第六章 第二节
- Python yield 使用浅析 (ibm-developerworks)
- PYTHON之路(十)
- Python 练习实例9
- Python 练习实例8
- python-MySQL学习笔记-第二章-在特定数据库中创建表
- Python 练习实例7
- python 连接操作 各类数据库
- Python 练习实例6
- Python 练习实例5
- python os.path与路径相关的
- 【Python笔记】图片处理库PIL的源代码安装步骤
- Python 练习实例4
- python-MySQL学习笔记-第一章链接到并创建数据库
- python小模块----cookie
- Python 带参主函数
- life is short, you need python
- life is short, you need python