Apr-02-2019, 06:56 AM
Little mental exercise: data cleaning with list comprehension, string methods and indexing:
In [1]: lst = [ ...: '"1":"[email protected]","p":"password1","r":"PYTHON DEMO OUTPUT","d":"yahoo.com"', ...: '"2":"[email protected]","p":"password2","r":"PYTHON DEMO OUTPUT","d":"mail.bg"', ...: '"3":"[email protected]","p":"password3","r":"PYTHON DEMO OUTPUT,"d":"ya.ru"' ...: ] In [2]: [row.split(':')[i].split(',')[0].strip('"') for row in lst for i in [1, 2, 4]] Out[3]: ['[email protected]', 'password1', 'yahoo.com', '[email protected]', 'password2', 'mail.bg', '[email protected]', 'password3', 'ya.ru']
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.