1.find函数
find() 方法检测字符串中是否包含子字符串 str ,如果指定 beg(开始) 和 end(结束) 范围,则检查是否包含在指定范围内,如果指定范围内如果包含指定索引值,返回的是索引值在字符串中的起始位置。如果不包含索引值,返回-1。
string='abcde' x=string.find('a') y=string.find('bc') z=string.find('f') print(x) print(y) print(z) #运行结果 0 1 -1
2.index函数
index() 方法检测字符串中是否包含子字符串 str ,如果指定 beg(开始) 和 end(结束) 范围,则检查是否包含在指定范围内,该方法与 python find()方法一样,只不过如果str不在 string中会报一个异常。
string='abcde' x=string.index('a') y=string.index('bc') #z=string.index('f') print(x) print(y) #print(z) 0 1 ValueError: substring not found
3.join 函数
Python join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。
lis=['a','b','c','d','e'] string='abcde' tup=('a','b','c','d','e') print(''.join(lis)) print(' '.join(string)) print('$'.join(tup)) #运行结果 abcde a b c d e a$b$c$d$e
注意序列里的元素必须是字符串,不能是数字
4.split函数
split() 通过指定分隔符对字符串进行切片,如果第二个参数 num 有指定值,则分割为 num+1 个子字符串。
str.split(str="", num=string.count(str))
string='this is an interesting story!' a=string.split() b=string.split(' ',2) c=string.split('s') d=string.split(',') print(a) print(b) print(c) print(d) #运行结果 ['this', 'is', 'an', 'interesting', 'story!'] ['this', 'is', 'an interesting story!'] ['thi', ' i', ' an intere', 'ting ', 'tory!'] ['this is an interesting story!']
5.strip函数
Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)或字符序列。
注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。
string='**this is an ***interesting story!***' a=string.strip('*') b=string.lstrip('*') c=string.rstrip('*') print(string) print(a) print(b) print(c) #运行结果 **this is an ***interesting story!*** this is an ***interesting story! this is an ***interesting story!*** **this is an ***interesting story!
lstrip和rstrip分别去掉左边和右边的指定字符。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 群星《前途海量 电影原声专辑》[FLAC/分轨][227.78MB]
- 张信哲.1992-知道新曲与精丫巨石】【WAV+CUE】
- 王翠玲.1995-ANGEL【新艺宝】【WAV+CUE】
- 景冈山.1996-我的眼里只有你【大地唱片】【WAV+CUE】
- 群星《八戒 电影原声带》[320K/MP3][188.97MB]
- 群星《我的阿勒泰 影视原声带》[320K/MP3][139.47MB]
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[320K/MP3][148.91MB]
- 刘雅丽.2001-丽花皇后·EMI精选王【EMI百代】【FLAC分轨】
- 齐秦.1994-黄金十年1981-1990CHINA.TOUR.LIVE精丫上华】【WAV+CUE】
- 群星.2008-本色·百代音乐人创作专辑【EMI百代】【WAV+CUE】
- 群星.2001-同步过冬AVCD【环球】【WAV+CUE】
- 群星.2020-同步过冬2020冀待晴空【环球】【WAV+CUE】
- 沈雁.1986-四季(2012梦田复刻版)【白云唱片】【WAV+CUE】
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[FLAC/分轨][257.88MB]
- 《国语老歌 怀旧篇 3CD》[WAV/分轨][1.6GB]