gpt4 book ai didi

python - 如何根据字母表拆分?

转载 作者:行者123 更新时间:2023-11-28 22:14:55 25 4
gpt4 key购买 nike

我正在尝试根据如下字母表进行拆分,但不知何故不起作用,我有当前和预期的输出,我做错了什么?如何解决?

chiprev = ['4355b3','4364a1','4278b3']

for rev in chiprev:
print rev.split("[a-b][A-B]")[-1]

当前输出:-

4355b3
4364a1
4278b3

预期输出:-

b3
a1
b3

最佳答案

for i in chiprev:
print(i[re.search(r'[a-zA-Z]',i).start():])

输出:

b3
a1
b3

关于python - 如何根据字母表拆分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53128577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com