a = '123:234*2222:888*44444:777*00000:999'
strlist = list()
while True:
if a.find('*') != -1:
strlist.append(a[:a.find('*')])
a = a[a.find('*') + 1:]
else:
strlist.append(a)
break
print(strlist)
将字符串'123:234*2222:888*44444:777*00000:999'以*分割成不同字符串
代码如上。
结果为: