# How to seperate text lines from txt files in python?

I am playing with a .txt file in python for EDA and I want to seperate the lines from this fashion:

Corona Virus = Justin Piper

COVID19 = Piper, Justin
Fed Paper Says Companies May Automate More Jobs During Pandemic https://t.co/SUqrMfpNJY

Donate the money
Might put food on plate
And smile on face 😊


to this fashion:

[['Corona Virus = Justin Piper'],['COVID19 = Piper, Justin
Fed Paper Says Companies May Automate More Jobs During Pandemic https://t.co/SUqrMfpNJY'],['Donate the money
Might put food on plate
And smile on face 😊']]


I tried .split('\t') but it is taking each line as a new row.

with open(file_name, 'r') as f:

By doing [x.strip()] you clear the whitespace at the beginning and end of the file and then wrap it in a list, and the condition x.strip() != '' makes sure that the line actually contains content and is not just a blank line.