zoukankan      html  css  js  c++  java
  • python入门 python字符串换行显示、字符串太长连接多行

    #coding:utf-8
    #/usr/bin/python
    """
    2018-11-03
    dinghanhua
    缩进
    换行
    """

    """python严格缩进 4个空格 通过缩进来区分语句块"""
    def add(a,b):
        return a+b

    def add2(a,b):
    return a+b    #故意没缩进,报错IndentationError: expected an indented block


    """字符串太长换行显示 反斜杠连接多行"""
    url = "https://www.cnblogs.com/"
          "dinghanhua"
          "/p/9900700.html"
    print(url)

    """多行输出,方式1—加换行符,方式2—三重引号保持原样输出"""
    str1 ="第一行 第二行 第三行"

    str2= """第一行
    第二行
    第三行"""

    print(str1)
    print(str2)

  • 相关阅读:
    SPI简述
    stm32和sd卡
    BKP和RTC
    Lwip与底层的接口
    关于Ad-hoc
    stm32 引脚映射 和 ADC
    GDB使用总结
    linux管道和重定向
    学习python的第四天
    学习pyton的第三天
  • 原文地址:https://www.cnblogs.com/barrywu/p/12090912.html
Copyright © 2011-2022 走看看