# pattern支持字符或者字符串
def my_split(string, pattern):
ret = []
len_pattern = len(pattern)
while True:
index = string.find(pattern)
if index == -1:
ret.append(string)
return ret
else:
ret.append(string[:index])
string = string[index+len_pattern:] if __name__=="__main__":
print(my_split("abcded", "cd"))
print(my_split("abcded", "d"))

最新文章

  1. mysql 用法记录和常见错误,持续更新。
  2. macbook 重装win7
  3. Block作为property属性实现页面之间传值(代替Delegate代理与协议结合的方法)
  4. 堡垒机 paramiko代码
  5. 如何鉴别程序抄袭c语言程序代写
  6. ELK Packetbeat 部署指南(15th)
  7. DTD简单使用
  8. MVC-04 视图(2)
  9. (76) Clojure: Why would someone learn Clojure? - Quora
  10. 获取IIS版本
  11. Unity UGUI实现分段式血条
  12. Drupal7.8的安装注意的问题
  13. Linux系统的数据写入机制--延迟写入
  14. Spine用于Timeline(NullReferenceException: Object reference not set to an instance of an object pine.Unity.Editor.AnimationReferenceAssetEditor.OnInspectorGUI ())
  15. Zabbix监控中,使用的比较好的动作信息模板
  16. asp.net core 发布到 docker 容器时文件体积过大及服务端口的配置疑问
  17. Tomcat 9.0 安装配置
  18. poj2632 【模拟】
  19. python中的%s%是什么意思
  20. POJ 3662 Telephone Lines (二分+Dijkstra: 最小化第k大的值)

热门文章

  1. SpringBoot--自动配置原理-4个注解
  2. [Web安全]SQL注入
  3. @Html.DropDownList()的四种用法及自定义DropDownList扩展
  4. 1.spring异常:Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
  5. (转)KMP算法
  6. python itertool 浅谈迭代工具
  7. java基础之 修饰符
  8. jvm(1):内存结构
  9. 在Linux服务器上安装Python3.7
  10. Educational Codeforces Round 76 (Rated for Div. 2) C. Dominated Subarray