python语法
为肖妹再坚持一秒
这个作者很懒,什么都没留下…
展开
-
anaconda中找到IDLE的方法
cmd中直接输入idle,回车原创 2022-02-22 17:52:12 · 780 阅读 · 0 评论 -
【python】strip及rstrip使用方法
print( 'mississippi'.rstrip('ip'))#输出的结果是mississprint( 'workplace'.strip('wce'))#输出的结果是orkplastrip函数会去掉首尾指定字符直到下一个字符不是指定的字符为止。原创 2022-01-19 15:53:55 · 413 阅读 · 0 评论 -
python replace和re.sub的两种替换方法
# 1、用字符串本身的replace方法# 复制代码代码如下:a='hello,world,world'print(a.replace('world','python',1)) #1:最高代替次数#输出的结果是hello,python,world# 2、用正则表达式来完成替换:# 复制代码代码如下:import re# strinfo=re.compile('world')# b=strinfo.sub('python',a)strinfo=re.compile('world')b=.原创 2022-01-19 15:37:08 · 731 阅读 · 0 评论