Waring: Python newbie user question ;-)
I'm trying to use Python to read and interpret text files. I created these files (hundreds of them) over the cause of 6 years, trying to maintain a certain format: line 1: header then separated by 2 blank lines: one or more 'blocks' of text lines
These 'blocks' consist of the following items separated by a single blank line; 0, 1 or multiple lines with filenames 0, 1 or multiple lines with URL's 0, 1 or multiple lines with text
See a sample file below.
I am looking to reuse the contents of these text files, creating a process where I read the contents of a file into memory, then present me with buttons to copy the contents of a (set of) line(s) from a block onto the clipboard.
The problem I'm having is choosing what variable structure is best used to temporarily store the contents of the file in memory since none of these block have fixed content.
Any tips?
Sample file:
----------------------------
header
filename
url
text
text
filename
filename
url
text
filename
filename
url
url
text
text
text
url
text
text