zoukankan      html  css  js  c++  java
  • Python 字符串

    var1 = 'Hello World!'

    var2 = "This is String"

    python不支持单字符类型,单字符在python中也被作为一个字符串使用

    访问

    通过切片的方式

    代码:

    输出:

    修改

    切片 + 连接符

    代码:

    输出:ell   xxxx

    转义字符

    字符串运算符

    右下角两个输出为:

    format() 

    两种方式:位置参数   + 关键字参数,常常和字段——{ } 连用

    位置参数

    代码:

    输出:l love python.ai

    关键字参数

    代码:

    输出:l love python.ai

    代码:

    输出:27.7GB

    # 替换域中‘:’表示格式化符号的开始
    .1 ---> 四舍五入保留一位小数点

    字符串格式化

    代码:

    输出:

    格式化操作符的辅助指令

    内置函数

    https://fishc.com.cn/thread-38992-1-1.html

  • 相关阅读:
    networktool3
    networktool2
    networktool
    Intel Zepher 介绍
    使用IPMI发送事件1让BMC log 填满
    Knights Landing
    Intel历代处理器
    Intel Datacenter Group Public Roadmap
    django的url路由
    position用法
  • 原文地址:https://www.cnblogs.com/expedition/p/10685866.html
Copyright © 2011-2022 走看看