Answers for "python split string keep delimiter"

0

python split string keep delimiter

line = "<html><head>"
d = ">"
s =  [e+d for e in line.split(d) if e]
print(s)
#Output:
#["<html>", "<head>"]
Posted by: Guest on December-23-2020

Code answers related to "python split string keep delimiter"

Python Answers by Framework

Browse Popular Code Answers by Language