zoukankan      html  css  js  c++  java
  • Python-基础数据类型

    Numbes:

    integer

    float point

    complex: e.g. (-5+4j)

    Strings:

    单引号双引号用法一致,

    三个单引号或三个双引号表示多行字符串

    '''first line

    second line,

    third line.

    '''

    raw strings:让转义字符变为一般字符

    r'Newlines are indicate by ',打印结果为Newlines are indicate by

    一旦创建一个string,就不能改变它。

    format方法

    age = 25

    name = 'Swaroop'

    print('{0} is {1} years old'.format(name,age))

    结果:Swaroop is 25 years old

    不需要声明或定义变量的数据类型

    缩进:

    python通过缩进来区分每一组语句,而不是像C++中的大括号{}

    缩进可以用Tab或空格,一般使用4个空格

  • 相关阅读:
    通过dockerfile制作nginx镜像
    docker存储卷
    docker容器网络配置
    状态模式
    抽象工厂模式
    观察者模式
    建造者模式
    外观模式
    模板方法模式
    原型模式
  • 原文地址:https://www.cnblogs.com/johnsblog/p/3959297.html
Copyright © 2011-2022 走看看