Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 'spam eggs'
'spam eggs'
>>> 'doesn\'t' #单引号转义
"doesn't"
>>> '"yes",he said .'
'"yes",he said .'
>>> "\"yes,\" he said"
'"yes," he said'
>>> '"Isn\'t," she said'
'"Isn\'t," she said'
>>> print('"Isn\'t," she said')
"Isn't," she said
>>> s = 'First line.\n Second line' #"\n" 意味着新的一行
>>> s
'First line.\n Second line'
>>> print(s)
First line.
Second line
>>> print('c:\some\name') #here \n means newline
c:\some
ame
>>> print(r'c:\some\name')
c:\some\name
>>> print("""\
    Usage: thingy [OPTIONS]
           -h               Display this usage message
           -H   hostname    Hostname to connect to
           """)
    Usage: thingy [OPTIONS]
           -h               Display this usage message
           -H   hostname    Hostname to connect to
>>> # 3 times 'un' ,followed by 'ium'
>>> 3*'un' + 'ium'
'unununium'
>>> 'Py' 'thon'
'Python'
>>> text =('put several strings within parentheses'
           'to have them joined together')
>>> text
'put several strings within parenthesesto have them joined together'
>>> word = 'Python3'
>>> word[0]
'P'
>>> word[5]
'n'
>>> word[-1]
'3'
>>> word = 'Python'
>>> word[0]
'P'
.
>>> word[5]
'n'
>>> word[0:2]
'Py'
>>> word[2:5]
'tho'
>>> word[:2]+word[2:]
'Python'
>>> word[:4]+word[4:]
'Python'
>>> word[-2:]
'on'
>>>

python3 slice相关推荐

  1. Python:Python3错误提示TypeError: slice indices must be integers or None or have an __index__ method解决办法

    Python:Python3错误提示TypeError: slice indices must be integers or None or have an __index__ method解决办法 ...

  2. Python3 TypeError: cannot do slice indexing on Index with these indexers [1] of type int

    读取excel时,不加header=None,则报错TypeError: cannot do slice indexing on Index with these indexers [1] of ty ...

  3. Python3 字符串切片 slice 操作

    答案: "to be or not to be".[::-1] "sxtsxtsxtsxtsxt".[::]

  4. Python3.5源码分析-内建模块builtins初始化

    Python3源码分析 本文环境python3.5.2. 参考书籍<<Python源码剖析>> python官网 Python3模块初始化与加载 Python的模块分为内建的模 ...

  5. Python3中的内置函数总结

    1.内置函数的查找 内置函数都定义在一个叫builtins模块中,此模块默认在python环境启动的时候就自动导入,可以直接使用这些函数,不用import 模块名. globals():列出当前环境下 ...

  6. python3和Python2的区别

    print函数:(Python3中print为一个函数,必须用括号括起来:Python2中print为class) Python 2 的 print 声明已经被 print() 函数取代了,这意味着我 ...

  7. centos7 python3.6升级到3.7_Centos7 升级python3,解决升级后不兼容问题

    一.确实当前python版本 [root@centos Python-3.6.1]# python Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC ...

  8. 循序渐进Python3(二) -- 数据类型

    数据类型 一.数字(int) Python可以处理任意大小的正负整数,但是实际中跟我们计算机的内存有关,在32位机器上,整数的位数为32位,取值范围为 -2**31-2**31-1,在64位系统上,整 ...

  9. python3.x与python2.x的区别汇总

    python3.x与python2.7.x都是比较流行的版本,虽然建议现在的初学者开始学习python3.x的版本,但是还有很多的工程使用的是python2.7.x版本.观看代码的时候难免会出现一些问 ...

最新文章

  1. syslog 向内存中缓存_漫谈缓存(Cache)、大规模芯片系统的存储层次结构优化以及开源仿真工具ZSim...
  2. springboot中关闭eureka server中已注册服务列表自我保护配置
  3. Python3 编程示例:斐波纳契数列
  4. 苹果、联想及华硕均看准美国电脑运输的增长
  5. tomcat(15)Digester库
  6. android git项目管理,Android Studio中如何使用Git和Github来管理项目
  7. 最新创意购物促销海报设计,广告人必看!
  8. 数据中台公开课丨可以复用的中台架构建设经验与实践
  9. uniapp 树组件 可设置展开层级 可设置回显内容 可设置单选多
  10. html a href 文件下载 IE直接打开 内容乱码
  11. Excel学习之旅(三)
  12. 在本地安装使用-LTP
  13. ElasticSearch搜索详细讲解与操作
  14. 如何不改一行代码,让Hippy启动速度提升50%?
  15. 电脑上有哪些好用的视频剪辑软件
  16. shell之awk命令详解
  17. [Plant Simulation]使用Battery的Transporter(Battery参数的使用以及小车状态统计)
  18. mysql 查询成绩排名_mysql 学生成绩查询排名
  19. [分享]iOS开发 - 网络总结
  20. Java API 访问HA模式下的HDFS集群

热门文章

  1. 西门子mag6000接线_电磁流量计MAG5000或MAG6000,通过脉冲输出累积流量,脉冲输出如何接线,如何设置参数?...
  2. cocos2dx linux eclipse,如何将cocos2dx移植到eclipse上?
  3. 游戏服务器维护重启,游戏服务器需要定期重启吗
  4. 试述hadoop生态系统以及每个部分的具体功能_Hadoop在大数据分析中的意义和作用...
  5. java计算加速减速_java – 使用JOCL / OPENCL计算强度的加速总和
  6. Appfuse下载及安装步骤
  7. 2022年Java程序设计讲课笔记
  8. VB案例:多功能文本处理器
  9. 用Java通讯录字母排序,按所有Catorgories显示联系人数据库标记,然后按字母顺序排序| PHP SQL...
  10. 蝴蝶优化算法_腾讯机智团队分享--AllReduce算法的前世今生