转载请标明出处:

http://www.cnblogs.com/why168888/p/6407977.html

本文出自:【Edwin博客园】

Python切片

1. 对list进行切片

L = range(1, 101)
print L[:10]
print L[2::3]
print L[4:50:5]

2. 倒序切片

L = range(1, 101)
print L[-10:]
print L[-46::5]

3. 对字符串切片

def firstCharUpper(s):
return s[0].upper() + s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')

最新文章

  1. asp.net权限控制配置web.config
  2. linux主机间复制文件
  3. :nth-child()和:nth-of-type(n)区别
  4. 企业级的App发布流程
  5. HTML5文档结构语义:页眉的header和hgroup标签使用
  6. NPOI的源代码编译
  7. Java架构必会几大技术点(转)
  8. Peter Pan By: J. M. Barrie
  9. AngularJs学习笔记5——自定义服务
  10. 内核加载与linux的grub
  11. checking for known struct flock definition... configure: error: Don't know how to define struct flock on this system, set --enable-opcache=
  12. C#、Java之比较
  13. bzoj3963[WF2011]MachineWorks cdq分治+斜率优化dp
  14. python-django(框架结构)
  15. PyCharm 使用Github管理Django项目
  16. mysql游标中使用临时表
  17. Qt532.QString_填充字符
  18. 限定某个目录禁止解析php 、限制user_agent 、php的配制文件、PHP的动态扩展模块
  19. Golang Email
  20. 高性能网络编程(一):单台服务器并发TCP连接数到底可以有多少

热门文章

  1. liunx下查看日志最实用命令和方法
  2. Firebird with lock
  3. 异步http请求的实现
  4. 如何理解animation-fill-mode及其使用?<转>
  5. 01.MD5加密
  6. Vue指令(四)--v-model
  7. python中的单例模式的应用
  8. CSS3之 :nth-child(n)语法讲解
  9. 【Android】12.0 UI开发(三)——列表控件ListView的简单实现2
  10. CSS3动画功能