Apr-27-2020, 04:31 AM
hi deanhystad,
I tried to understand the code for the last few days and how I could print lines not he line numbers but is too complicated for me now.
1. two Vars cnt = 1, flag = False
Why count =1 and why it is declared in the with open block? why not predeclared with the rest of the Vars?
What does the "flag = False" mean and why it is declared in the same block?
2. In the IF block this:
last_lstart = cnt # Indent was wrong
last_lstr = None
Why "last_lstart = cnt" what is that you counting?
Why "last_lstr = None" it is None if it was predeclared None already?
3. in the elif block
last_lstr = cnt Why you count this sctring?
cnt += 1
line = fp.readline() Why you read the line again here if it is was read above in the whit open block?
Thank you.
I tried to understand the code for the last few days and how I could print lines not he line numbers but is too complicated for me now.
1. two Vars cnt = 1, flag = False
Why count =1 and why it is declared in the with open block? why not predeclared with the rest of the Vars?
What does the "flag = False" mean and why it is declared in the same block?
2. In the IF block this:
last_lstart = cnt # Indent was wrong
last_lstr = None
Why "last_lstart = cnt" what is that you counting?
Why "last_lstr = None" it is None if it was predeclared None already?
3. in the elif block
last_lstr = cnt Why you count this sctring?
cnt += 1
line = fp.readline() Why you read the line again here if it is was read above in the whit open block?
Thank you.