I’m relatively new to programming and trying get a (very) long list of information into a table using Python. I installed HTML.py from Decalage and now need to get my list turned into into a list of lists that HTML.py can parse.
Is there an easy way to split a list like this:
['(617) 965-2555<br />\nOrganization Name', 'Street Name', 'City', 'Zip code', '(413) 333-2251<br />\nOrg Name 2', 'Address', 'City', 'Zip code 2', '(617) 568-7777</p>\n\n']
into a list of lists at “\n”?
So ideally the result would look like something like this:
[ ['Previous info', '(617) 965-2555<br />']
['Organization name', 'Street name', 'City', 'Zip Code', '(413) 333-2251<br />']
['Org Name 2', 'Address', 'City', 'Zip Code 2', '(617) 568-7777</p>']
]
Suggestions for an alternate method of getting that list into an organized table a la HTML.py would also be helpful.
If you want it flattened:
Edit:
Thanks to @agf’s comment, now I got it i think:
Assuming “{}” is never used on your original list, else change it to something not in your list,
|,;:;etc.And you can easily filter the output for removing list contains just empty strings with: