我有例如Python的分裂的 「%NumberNumber」
mystr = "Thisisaexample123%20321Lorem%29Ipsum%28Bad123Example%20Hopefully"
以下字符串什麼,我想實現的是:
array = mystr.split("%NumberNumber")
for unit in array:
print(unit)
控制檯:
Thisisaexample123
321Lorem
Ipsum
Bad123Example
Hopefully
嗯。 ..也許使用正則表達式?
不會它是第二行的'Lorem'。在這種情況下,使用're.split(「%\ d +」,str)'(並且不要調用變量'str') –
不,它應該是321Lorem,我希望它被每個百分比符號%接着是2個數字。 或者我希望所有的%NumberNumber被替換爲「;」所以我可以分裂在「;」 – Th0m45