My text file is a Python list.
I'm trying to read this into a python list and this is what I have
with open('C:\\Users\\Moondra\Anaconda_related\Jupyer_notebooks\MachineLearning\Small_cap_Bio.txt', 'r') as f:
lines = f.read().split('\n')
bio = [ i.replace('"',"").replace("'","").replace('[', '').replace(']', '').replace(',','').lstrip().rstrip() for i in lines]
Besides using regular expressions, is there a cleaner(easier to understand) way to write this code?
Thank you.