Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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>"]
Comment

PREVIOUS NEXT
Code Example
Python :: destroy label tkinter 
Python :: PY | websocket - server 
Python :: python turtle fill 
Python :: merge two dictionaries 
Python :: how to add values to a list in python 
Python :: password guessing game python 
Python :: remove part of string python 
Python :: ast python 
Python :: how to use the super 
Python :: What is the use of f in python? 
Python :: timedelta python 
Python :: squre value of a column pandas 
Python :: from django.db import models 
Python :: save model pytorch 
Python :: how to show mean values on histogram in seaborn 
Python :: str replace pandas 
Python :: python find index of an item in an array 
Python :: convert pandas.core.indexes.numeric.int64index to list 
Python :: fastapi upload file save 
Python :: download csv file from jupyter notebook 
Python :: HUNGRY CHEF codechef 
Python :: python get cos sim 
Python :: find a key in a dictionary python 
Python :: combine dictionaries, values to list 
Python :: create a 2d array in python 
Python :: how to kill a script if error is hit python 
Python :: django signals post_save not working 
Python :: Highlight Active Links in Django Website 
Python :: classification cross validation 
Python :: raising custom exception python 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =