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

  • 相关阅读:
    CSS语言
    HTML语言
    JDBC技术
    存储过程
    Oracle和Mysql数据库技术
    正则表达式
    反射
    XML技术
    设计模式初步专题(自学,适合初级.更深入的会在框架阶段)
    线程池专题(自学)
  • 原文地址:https://www.cnblogs.com/keke-xiaoxiami/p/3920273.html
Copyright © 2011-2022 走看看