>>> s='spam'

>>> s=s.replace('m','111')

>>> s

'spa111'

>>> where=s.find('11')

>>> where

3

>>> s=s[:where]+'eggs'+s[(where+2):]

>>> s

'spaeggs1'

>>> L=list(s)

>>> L

['s', 'p', 'a', 'e', 'g', 'g', 's', '1']

>>> s=''.join(L)    #把对象插入到join的参数内,插入位置为参数内分隔符的位置,以对象作为分隔符

>>> s

'spaeggs1'

>>> 'spam'.join(['aaa','bbb','ccc',])    #S.join(iterable) -> str    Return a string which is the concatenation of the strings in the iterable.  The separator between elements is S.

'aaaspambbbspamccc'

replace find join的更多相关文章

  1. query specified join fetching, but the owner of the fetched association was not present in the select list

    报标题的错误,是因为在 select count的时候,不需要fetch 所以在取完count以后,再把fetch加进去,变成left join  fetch /** * 请把jhql以o为返回对象, ...

  2. 【Go】strings.Replace 与 bytes.Replace 调优

    原文链接:https://blog.thinkeridea.com/201902/go/replcae_you_hua.html 标准库中函数大多数情况下更通用,性能并非最好的,还是不能过于迷信标准库 ...

  3. BeautifulSoup

    参考:http://www.freebuf.com/news/special/96763.html 相关资料:http://www.jb51.net/article/65287.htm 1.Pytho ...

  4. Python之路【第二篇】python基础 之基本数据类型

    运算符 1.算数运算: 2.比较运算: 3.赋值运算: 4.逻辑运算: 5.成员运算: name = "yehaoran " # in 判断ye是否在name里面 在的话返回ok ...

  5. 基本数据类型-列表_元组_字典_day4

    一.列表(list)书写格式:[] #通过list类创建的 li = [1, 12, 9, ", 10, ],"庞麦郎"], "ales", True ...

  6. Python学习笔记——Day4

    字符串操作 string典型的内置方法: count() center() startswith() find() format() lower() upper() strip() replace() ...

  7. Python2

    安装pycharm专业版,不要汉化 要想写的代码支持linux和2.0版本需要在开头加上注释 #/usr/bin/env python #-*- coding:utf-8 -*- 运算符 结果是值 算 ...

  8. jQuery1.4源码解读

    来吧, 慢慢折腾吧 总结一下: jq1.4挺简单的, 正则写的不多, 看的都懂, 多写一些 三目写法到底要不要 特殊的地方的注释一定要有 /*! * jQuery JavaScript Library ...

  9. 阿里云DRDS:分布式数据库服务

    最近在做阿里云相关的项目,用到阿里的很多接口服务的API,于是想把这段项目做个总结,顺便梳理下阿里云的云计算的相关知识点. DRDS:分布式数据库服务. 1.相关术语 DRDS(Distribute  ...

随机推荐

  1. js中的事件绑定的三种方式

    1 直接在html标签中绑定 <button onclick = "show()"></button> 注意当你引用的js代码是包裹在window.onlo ...

  2. ElasticSearch(三):通分词器(Analyzer)进行分词(Analysis)

    ElasticSearch(三):通过分词器(Analyzer)进行分词(Analysis) 学习课程链接<Elasticsearch核心技术与实战> Analysis与Analyzer ...

  3. 说一说JVM双亲委派机制与Tomcat

    双亲委派模型与JVM 类加载 讲个故事: 以前,爱捣鼓的小明突然灵机一动,写出了下面的代码 package java.lang; public class String { //...复制真正Stri ...

  4. 『题解』Codeforces9D How many trees?

    更好的阅读体验 Portal Portal1: Codeforces Portal2: Luogu Description In one very old text file there was wr ...

  5. nuxt.js 部署静态页面[dist]到gh-pages

    一. 1.添加package.json { "name": "nuxtweb001", "version": "1.0.0&quo ...

  6. html5自动弹出软键盘的方法

    html5自动弹出软键盘的方法<pre> <textarea placeholder="说点什么......" autofocus="autofocus ...

  7. ASP.NET Core 1.0: 指定Default Page

    前不久写过一篇Blog<指定Static File中的文件作为Default Page>,详细参见链接. 然而,今天偶然发现了一个更加简洁的方法,直接使用Response的Redirect ...

  8. SpringBoot 源码解析 (五)----- Spring Boot的核心能力 - 自动配置源码解析

    在上一篇博客中分析了springBoot启动流程,大体的轮廓只是冰山一角.今天就来看一下springBoot的亮点功能:自动化装配功能. 先从@SpringBootApplication开始.在启动流 ...

  9. SparkSQL--数据源Parquet的加载和保存

    一.通用的load和save操作 对于Spark SQL的DataFrame来说,无论是从什么数据源创建出来的DataFrame,都有一些共同的load和save操作.load操作主要用于加载数据,创 ...

  10. sparkSQL 简介

    一.Spark SQL的特点 1.支持多种数据源:Hive.RDD.Parquet.JSON.JDBC等.2.多种性能优化技术:in-memory columnar storage.byte-code ...