zoukankan      html  css  js  c++  java
  • Python中单引号,双引号,三引号

    1、单引号与双引号的区别

    s1=‘let‘s go’(明显我们是想用单引号表示let’s go这个字符串的,但是python只知道用‘’来表示字符串,所以python就把字符串中的‘字符当成单引号处理了,所以这种情况下我们通常用双引号)

    s2=“let’s go”(这样更清晰)

    2、双引号与三引号区别

    双引号所表示的字符串通常要写成一行

    如:s3=“hello world”

    如果要写成多行,那么就要使用(连行符)

    如:s4=“hello

    world”

    s3和s4是一样的,如果使用三引号,就可以这样写了

    如:s5=‘’‘hello

    world’‘’

     附:多行显示

    >>> s='this is a string.
    ... this row continues the string.'
    >>>
    >>> print s
    this is a string. this row continues the string.
    >>>

  • 相关阅读:
    DLL库
    C#:时间转换
    视频通信网址
    C#:向exe传值
    C#:复杂条件判断类型(练习)
    注册、卸载DLL
    Windows:常见问题
    WPF:常见问题
    CentOS完美搭建Redis3.0集群并附测试
    xargs命令
  • 原文地址:https://www.cnblogs.com/zqq521/p/6397182.html
Copyright © 2011-2022 走看看