Python Split String Keep Delimiter

[Solved] Python Split String Keep Delimiter | Perl - Code Explorer | yomemimo.com
Question : python split string keep delimiter

Answered by : oscar-capraro

line = "<html><head>"
d = ">"
s = [e+d for e in line.split(d) if e]
print(s)
#Output:
#["<html>", "<head>"]

Source : https://stackoverflow.com/questions/7866128/python-split-without-removing-the-delimiter | Last Update : Wed, 30 Dec 20

Answers related to python split string keep delimiter

Code Explorer Popular Question For Perl