python中pop()与split()的用法
imglist = ['11.jpg','12.jpg','13.jpg','14.jpg','2.jpg','1.jpg',]
print(str(imglist))
a = str(imglist).split(".")
print(a)
fTail = a.pop()
print("-------------------")
print(fTail)
print("----$%%%%%%%%---")
print(a) # aList = [123, 'xyz', 'zara', 'abc']
# print("A List : ", aList.pop())#默认去除最后一个元素,打印出A List : abc
# print("B List : ", aList.pop(2))#去除下标为2的元素,打印出B List : zara
# print (aList)#打印出[123,'xyz'] #!/usr/bin/python3 str = "this is string example....wow!!!"
print (str.split( ))
print (str.split('i',1))
print (str.split('w'))
打印结果为
D:\software\python\python.exe D:/software/pycharmpython/login/bbb.py
['11.jpg', '12.jpg', '13.jpg', '14.jpg', '2.jpg', '1.jpg']
["['11", "jpg', '12", "jpg', '13", "jpg', '14", "jpg', '2", "jpg', '1", "jpg']"]
-------------------
jpg']
----$%%%%%%%%---
["['11", "jpg', '12", "jpg', '13", "jpg', '14", "jpg', '2", "jpg', '1"]
['this', 'is', 'string', 'example....wow!!!']
['th', 's is string example....wow!!!']
['this is string example....', 'o', '!!!'] Process finished with exit code 0
python中pop()与split()的用法的更多相关文章
- 谈谈Python中pop与remove的用法
remove() 函数用于移除列表中某个值的第一个匹配项. remove()方法语法: list.remove(obj) 如果obj不在列表中会引发 ValueError 错误,通常先使用count ...
- 【转】关于python中re模块split方法的使用
注:最近在研究文本处理,需要用到正则切割文本,所以收索到了这篇文章,很有用,谢谢原作者. 原址:http://blog.sciencenet.cn/blog-314114-775285.html 关于 ...
- 简单说明Python中的装饰器的用法
简单说明Python中的装饰器的用法 这篇文章主要简单说明了Python中的装饰器的用法,装饰器在Python的进阶学习中非常重要,示例代码基于Python2.x,需要的朋友可以参考下 装饰器对与 ...
- Python中【__all__】的用法
Python中[__all__]的用法 转:http://python-china.org/t/725 用 __all__ 暴露接口 Python 可以在模块级别暴露接口: __all__ = [&q ...
- python中enumerate()函数用法
python中enumerate()函数用法 先出一个题目:1.有一 list= [1, 2, 3, 4, 5, 6] 请打印输出:0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 打印输 ...
- Python中try...except...else的用法
Python中try...except...else的用法: try: <语句>except <name>: <语句> #如果在try ...
- Python中logging模块的基本用法
在 PyCon 2018 上,Mario Corchero 介绍了在开发过程中如何更方便轻松地记录日志的流程. 整个演讲的内容包括: 为什么日志记录非常重要 日志记录的流程是怎样的 怎样来进行日志记录 ...
- Python中zip()与zip(*)的用法
目录 Python中zip()与zip(*)的用法 zip() 知识点来自leetcode最长公共前缀 Python中zip()与zip(*)的用法 可以看成是zip()为压缩,zip(*)是解压 z ...
- python中的随机函数random的用法示例
python中的随机函数random的用法示例 一.random模块简介 Python标准库中的random函数,可以生成随机浮点数.整数.字符串,甚至帮助你随机选择列表序列中的一个元素,打乱一组数据 ...
随机推荐
- sort排序与二分查找
#include<iostream> #include<vector> #include<algorithm> #include<string> usi ...
- eclipse&myeclipse 生成jar包后,spring无法扫描到bean定义
问题:eclipse&myeclipse 生成jar包后,spring无法扫描到bean定义 在使用getbean或者扫包时注入bean失败,但在IDE里是可以正常运行的? 原因:导出jar未 ...
- BitSet源码
public class BitSet1 implements Cloneable, java.io.Serializable { // >>>左边补0, << 右边补0 ...
- 图论 --- BFS + MST
Borg Maze Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7844 Accepted: 2623 Descrip ...
- 【C学习笔记】一
一.运算符优先级 逻辑非>算术运算符>关系运算符>逻辑运算符>赋值运算符>逗号运算符 逻辑运算符>条件运算符>赋值运算符 对于if的执行语句,如果是一条语句那 ...
- Reliable Multicast Programming(PGM)协议
Reliable Multicast Programming (PGM)实际通用可靠多播协议,在某种程度上保证多播的可靠性.是IP上层协议,和TCP还有UDP同级,工作在传输层. 在组播传输视频项目中 ...
- python学习之旅
python学习分类 python基础 +- day01——python初始.变量.常量.注释.基础数据类型.输入.if day02——while.字符串格式化.运算符.编码初识 day03—— ...
- 【java】单实例下的 流水号【21位】
单实例环境,不是分布式 需要流水号 /** * 流水号生成器 * * 年+天号+毫秒+随机数 * 2019+134+480+11位随机数 * 4+3+3+11 = 21位 * * * @author ...
- kafka Enabling Kerberos Authentication
CDK 2.0 and higher Powered By Apache Kafka supports Kerberos authentication, but it is supported onl ...
- C#写入Excel文件方式
由于在工作中经常要把数据库的统计数据导入Excel文件,进行IO磁盘操作,所以在这里记录下. 首先创建默认文件夹,并返回文件夹路径. private static string CPath(strin ...