How to split string by empty lines in Python

1 Answer

0 votes
string = """First line

Second line

Third line"""

lst = string.split('\n\n')

print(lst)


'''
run:

['First line', 'Second line', 'Third line']
 
'''

 



answered Aug 6, 2022 by avibootz
...