Python编程入门

来源:互联网 发布:ubuntu libxml2devel 编辑:程序博客网 时间:2024/06/03 16:30

    0x00

    python的两种编程形式:

    1、交互式

    2、脚本式,也分两种方式。

    详见:http://www.runoob.com/python/python-basic-syntax.html。


    0x01

    Python有五个标准的数据类型:Numbers(数字)String(字符串)List(列表)Tuple(元组)Dictionary(字典)。

    详见:http://www.runoob.com/python/python-variable-types.html。

    后面另有文章详细介绍了各个内容:http://www.runoob.com/python/python-tutorial.html。


    0x02

    Python的运算符和语句:http://www.runoob.com/python/python-tutorial.html。

 

    0x03

    Python函数:http://www.runoob.com/python/python-functions.html。


    0x04

    Python文件I/O:http://www.runoob.com/python/python-files-io.html。

    Python File方法:http://www.runoob.com/python/file-methods.html。


    0x05

    Python异常处理:http://www.runoob.com/python/python-exceptions.html。    


    0x06

    Python模块:http://www.runoob.com/python/python-modules.html。

    模块就是一个文件,以.py为结尾的文件。

    导入并使用模块。

    1、import module

         module.function

    2、import module as modu

          modu.function

    3、from module import function 

         function

    4、from module import *

         function

    5、from 包 import 模板

         模板.函数


    Python包:包就是一个目录,里面放着很多模块(.py)。每个包里面必须有一个__init__.py。

    bao:

    __init__.py

    module.py

    moduleA.py


    导入并使用包:

    1、import bao

         bao.module.function

    2、import bao.module

         module.function

    3、import bao.module.funtion

          function


    0x07

    Python面向对象。包括Python中私有变量、静态变量、静态函数、继承的表示。

    详见:Python面向对象编程指南。

0 0