I'm totally new to coding. And this is killing me, I feel i'm missing something super fundamental but I just can't work it out...
Very simply, I am using a for loop to look at each line of a text file. If a empty line is found, I wish to update a counter.
I then wish to use the counters information to be able to change variable names which will then have the particular line from the text file saved into it.
SO at the end of the script, a variable name ParagraphXLineX will correspond with the appropriate paragraphs as found in the text file.
But I cannot seem to understand how to use a counters information to make a variable.
PARA_COUNT = 1
LINE_COUNT = 1
for x in CaptionFile_data.splitlines():
if x != "": #still in existing paragraph
(PARA_COUNT_LINE_COUNT) = x #I know this syntax isn't right just not sure what to put here?
LINE_COUNT += 1
else: #new paragraph has started
PARA_COUNT += 1
LINE_COUNT = 1