I just beginning to program in Python. I have read in some records from a text file into lists where the fourth item in the record is a long string which sometimes spans multiple lines. For example,
[ *, *, *, TXT1]
[TXT2]
[TXT3]
[ *, *, *, TXT4]
[TXT5]
[ *, *, *, TXT6]
[ *, *, *, TXT7]
How can I create a new list of lists from the original such that it correctly shows
[ *, *, *, TXT1+TXT2+TXT3]
[ *, *, *, TXT4+TXT5]
[ *, *, *, TXT6]
[ *, *, *, TXT7]
Assuming you have a list of lists here called
linelistthat looks like[[*,*,*,TXT1],[TXT2],[TXT3],[*,*,*,TXT4],...]:At the end, your output will be like:
In use: