#encoding=utf-8
#reverse,用来反转list
a=['aa','bb','cc']
a.reverse()
print a#['cc', 'bb', 'aa']
#不能直接print a.reverse(),报None
#'tuple','dict','str' object has no attribute 'reverse',不能jiang字符串reverse

#join以指定连接符连接tuple,list,strin,dict,输出为str类型
seq1 = ['hello','good','boy','doiido']
print ':'.join(seq1)#hello:good:boy:doiido
seq2 = ('hello','good','boy','doiido')
print ':'.join(seq2)
seq3 = {'hello':1,'good':2,'boy':3,'doiido':4}
print ':'.join(seq3)#boy:good:doiido:hello输出是乱的
seq4 = 'hello good boy doiido'
print ':'.join(seq4)#h:e:l:l:o: :g:o:o:d: :b:o:y: :d:o:i:i:d:o

#split拆分字符串
a='hello good boy doiido'
print a.split()#['hello', 'good', 'boy', 'doiido']输出是list,括号内是根据什么字符来分割
#'list','tuple','dict' object has no attribute 'split'

#append,insert,remove,pop用法,只能操作list
b=['hello','good','boy','doiido']
b.append('hola')
print b#['hello', 'good', 'boy', 'doiido', 'hola']
b.insert(2,'luck')#['hello', 'good', 'luck', 'boy', 'doiido', 'hola']
print b
b.remove('hola')#['hello', 'good', 'luck', 'boy', 'doiido']
print b
print b.pop()#doiido,str类型
print b#['hello', 'good', 'luck', 'boy']

各种对list,string操作函数的总结的更多相关文章

  1. C++:string操作函数

    要想使用标准C++中string类,必须要包含 #include <string>// 注意是<string>,不是<string.h>,带.h的是C语言中的头文件 ...

  2. (转) Lua string 操作函数

    本文转自: http://www.cnblogs.com/newlist/p/3649388.html table.keys 返回指定表格中的所有键. 格式: keys = table.keys(表格 ...

  3. 字符串操作函数<string.h>相关函数strcpy,strcat,等源码。

    首先说一下源码到底在哪里找. 我们在文件中包含<cstring>时,如果点击右键打开文档, 会打开cstring,我们会发现路径为: D:\Program Files\visual stu ...

  4. python中string的操作函数

    在python有各种各样的string操作函数.在历史上string类在python中经历了一段轮回的历史.在最开始的时候,python有一个专门的string的module,要使用string的方法 ...

  5. string操作

    常用的功能测试: #! -*- coding:utf-8 -*- import string s = 'Yes! This is a string' print '原字符串:' + s print ' ...

  6. Delphi中复制带有String的记录结构时不能使用Move之类的内存操作函数

    请看下面的代码: program TestRecord; {$APPTYPE CONSOLE} uses  SysUtils,  Math; type  TRecordA = record    Na ...

  7. Python中字符串操作函数string.split('str1')和string.join(ls)

    Python中的字符串操作函数split 和 join能够实现字符串和列表之间的简单转换, 使用 .split()可以将字符串中特定部分以多个字符的形式,存储成列表 def split(self, * ...

  8. dedecms功能性函数封装(XSS过滤、编码、浏览器XSS hack、字符操作函数)

    dedecms虽然有诸多漏洞,但不可否认确实是一个很不错的内容管理系统(cms),其他也不乏很多功能实用性的函数,以下就部分列举,持续更新,不作过多说明.使用时需部分修改,你懂的 1.XSS过滤. f ...

  9. Delphi文件操作函数

    文件是同一种类型元素的有序集合,是内存与外设之间传输数据的渠道.文件的本质是一个数据流,所有的文件实际上是一串二进制序列.文件管理包括:1.文件操作.2.目录操作.3.驱动器操作.三部分. 1.常见文 ...

随机推荐

  1. redis安装和简介(1)

    一.Redis 简介 Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下三个特点: R ...

  2. HTMLFormElement获取表单里面所有的值然后以json形式返回

    function HTMLFormElement(){ this.init(); return this.json; } HTMLFormElement.prototype.init = functi ...

  3. iOS 8及以后版本 如何创建UIAlertView?

    1. Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated. ...

  4. NHibernate参考文档、下载地址

    没有中文版哦,在线NHibernate参考文档:http://nhforge.org/doc/nh/en/获取地址:http://sourceforge.net/projects/nhibernate ...

  5. Spring - 父容器与子容器

    一.Spring容器(父容器) 1.Mapper代理对象 2.Service对象 二.Springmvc(前端控制器)(子容器)        Controller对象 1.标准的配置是这样的:Con ...

  6. JasperReport4.6生成PDF中文

    Web项目中PDF显示中文 本人无奈使用JasperReport4.6,因为这本书(好像也是唯一的一本国内的介绍JasperReport的书), 选择"文件"→New命令,弹出一个 ...

  7. java判断类型

    判断是否String:str.getClass().getName().equals("java.lang.String") 判断是否在且不为空:Object.hasKey(&qu ...

  8. RMAN_PIPE

    涉及的dbms_pipe包中的过程和函数:(1)PACK_MESSAGE Procedures用途:Builds message in local buffer(2)SEND_MESSAGE Func ...

  9. java web多组件协作实现用户登录验证

    实现步骤: 1.创建用户登录提交界面 2.创建处理用户登录请求servlet组件Main 3.创建代表登录成功响应的servlet的组件LoginSuccess 4.创建代表登录失败响应的servle ...

  10. php源码建博客4--实现MVC结构微型框架

    主要: 常量优化路径 自动加载类 优化入口文件 安全访问项目目录 --------------文件结构:-------------------------------------- blog├─App ...