fname = input('Enter fline name: ')
if len(fname) < 1 : fname = 'mbox-short.txt'
fh = open(fname)
count = 0
for line in fh :
if 'From ' in line :
mail = line.split()
print(mail[1])
count = count + 1
else : continue
print('There were', count, 'lines in the file with From as the first word')
This is the code I saw while studying. I'm not sure how Len's presence or absence affects this code. There was no change even if I printed it out after annotating it... Why does it exist? Please give me some advice
python len
This line is
Write "mbox-short.txt"
as the default input if the input length is 0 or less (= if there is no input value).
I think it's a line that goes in that sense.
Comment on the line, rename the mbox-short.txt
file, and try again without any input. open(fname)
will probably pop.
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
612 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.