lymbwx
发表于 2022-9-27 18:33:40
小古比鱼 发表于 2020-11-20 11:58
三天前刚花费10鱼币购买了旧版的“字符串的方法及注释”,今天又要花费10鱼币购买新版的“字符串的各种方法 ...
多学习,鱼币够用的
墨墨在努力吖
发表于 2022-10-3 13:45:51
str = "i Love you"
>>> str.capitalize()
'I love you'
>>> str.casefold()
'i love you'
>>> str.title()
'I Love You'
>>> str.swapcase()
'I lOVE YOU'
>>> str.upper()
'I LOVE YOU'
>>> str.lower()
'i love you'
>>> s = "墨墨要努力吖~"
>>> s.center(5)
'墨墨要努力吖~'
>>> s.center(10)
' 墨墨要努力吖~'
>>> s.ljust(10)
'墨墨要努力吖~ '
>>> s.rjust(10)
' 墨墨要努力吖~'
>>> s.zfill(10)
'000墨墨要努力吖~'
>>> s.center(8)
'墨墨要努力吖~ '
>>> s.center(15)
' 墨墨要努力吖~ '
>>> t = '5201314'
>>> t.zfill(10)
'0005201314'
滴滴滴~打卡{:10_298:}
风一样的僧
发表于 2022-10-3 17:29:45
{:10_254:}
foolwolf0068
发表于 2022-10-5 10:11:06
字符串我来啦
小丸子123
发表于 2022-10-16 10:01:34
x='12321'
"是回文数。"if x==x[::-1]else"不是回文数"
'是回文数。'
x='12345'
"是回文数。"if x==x[::-1]else"不是回文数"
'不是回文数'
x="hello world"
x.capitalize()
'Hello world'
x.casefold()
'hello world'
x.title()
'Hello World'
x.upper()
'HELLO WORLD'
x.lower()
'hello world'
荔Ⅹ
发表于 2022-10-27 15:01:12
学习学习
yes120
发表于 2022-10-28 09:39:53
学习打卡
migu_sm1
发表于 2022-11-2 12:36:01
Learning...
独酌dz
发表于 2022-11-6 19:21:35
6
jioug
发表于 2022-11-22 19:02:35
s = input("请输入一个字符串:")
res = []
for each in s:
if res and res[-1].lower() == each.lower() and res[-1] != each:
res.pop()
else:
res.append(each)
for each in res:
print(each, end='')
if res and res[-1].lower() == each.lower() and res[-1] != each:这个判断条件没看懂 那位大神帮忙解答下:
1:为什么要加 res ? 正常的应该是直接取res[-1] 进行对比就可以了
2:为什么后面要加res[-1] != each
我的理解判断条件应该是 if res[-1]==each.lower() andres[-1].lower()==each
xxxx.xxxx
发表于 2022-12-1 16:45:42
这一节课还是比较简单的
andyleesh
发表于 2022-12-20 19:24:54
学习打卡
Hello1?
发表于 2022-12-27 14:46:29
好实用
Wynn_0303
发表于 2023-1-28 15:25:47
{:10_256:}
Luce
发表于 2023-2-2 14:30:56
复习打卡完成
Steven.Zheng
发表于 2023-2-10 13:05:52
{:5_101:}
littlewhale
发表于 2023-3-1 12:55:49
打卡~~~
2814510602
发表于 2023-3-15 15:25:53
打卡
来自成都的momo
发表于 2023-4-9 23:04:33
加油
justsingmysong
发表于 2023-6-6 20:16:01
1024