'''string切片'''
def string_split(stringone,split):
m = []
if type(split)!=str:
return False
if split not in stringone :
m.append(stringone)
return m
if type(stringone)!=str:
return False
if not split:
m.append(stringone)
return m
else:
h=0
l=0
for i in range(len(stringone)):
if stringone[i]==split:
if i==0 and h==0:
n = (stringone[0])
elif h>0:
n=stringone[l:i]
else:
n=stringone[0:i]
if i==len(stringone)-1:
c = stringone[len(stringone)-1]
elif h>0 :
c=stringone[-1]
else:
c=''
if len(n)!=0 :
m.append(n)
if len(c)!=0:
m.append(c)
i += 1
h += 1
l= i
else:
i+=1
return m
print(string_split('12,22,11',split='1,'))

最新文章

  1. HTML块级元素
  2. python读取excel数据,并可视化展现
  3. iOS中编写单例类的心得
  4. 琐碎--选择文件夹(路径)+生产txt格式的log+数据库操作方式
  5. easyui的combobox下拉框初始化默认值以及保持该值一直显示的方法
  6. [原创]EnterpriseDB测试key申请方法
  7. 1050 数的计数 c语言实现
  8. Swift2.0新特性
  9. 操作12864(ST7920控制器)
  10. Swift String 一些常用方法
  11. java特权制度设计篇
  12. mysql命令[转]
  13. Mybash的实现
  14. centos6.5搭建hadoop完整教程
  15. canvas20181114
  16. python 模块之-time
  17. 关于trim,ltrim ,rtrim 的 移除问题
  18. Spring Cloud之注册中心搭建
  19. spring boot映射静态资源.
  20. 获取转UTF8的字符串

热门文章

  1. python面试十题
  2. VC2010 配置OpenGL环境(转)
  3. November 16th 2016 Week 47th Wednesday
  4. ASP.NET MVC 4 RC的JS/CSS打包压缩功能
  5. 安装64位php开发环境
  6. ZT 内地20年经典电视剧大全
  7. python的unittest框架中如何删除测试数据,清理环境,可以通过addCleanup函数
  8. Uva10048 Audiophobia (Floyd)
  9. 【洛谷】【动态规划(二维)】P1508 Likecloud-吃、吃、吃
  10. MongoDb 物理位置应用实现