zoukankan      html  css  js  c++  java
  • 【Python基础教程第2版】——第一讲:基础知识

    1、长字符串:(用三引号如'''或者"""来引起来)

    >>> print """
    This is a very log string.
    It continues here.
    And it's not over yet.
    "Hello world!"
    """

    This is a very log string.
    It continues here.
    And it's not over yet.
    "Hello world!"

    2、原始字符串:(注:最后面不要出现转义符,其他的都会保持原样显示,中间不用使用转义符)

    >>> print r'C: owhere'
    C: owhere

    3、字符串表示:str和repr

    (str函数:会把值转换为合理形式的字符串;repr函数:会创建一个字符换,以合法的Python表达式的形式来表示值)

    >>> print str(temp)
    42
    >>> print '1238934'+str(temp)
    123893442

    >>> print 'the temp is '+ repr(temp)
    the temp is 42

  • 相关阅读:
    pop指令的执行过程
    ipad 4.2 开发环境
    XP远程桌面
    停机问题、哥德尔定理
    看MIT的线性代数
    VizA项目继续推进
    port systemc to mac os x
    关于jar
    普桑
    拉突爾
  • 原文地址:https://www.cnblogs.com/keke-xiaoxiami/p/3920273.html
Copyright © 2011-2022 走看看