Python email churn project (File not found)


#1

/cxldata/datasets/project/mbox-short.txt

Do we have to create this path/file? Do not see it in “Files”?
No%20file


#2

Path is clearly mentioned in the project …it’s in /cxldata not in your home folder


#4

Thank you for that Mr.Abhinav.
Could you please look into my second query.

Python Project - Churn Emails - Count the Number of Subject Lines:

It is showing the right count but when I submit it shows :" Wrong count"


#5

Hi, Pavan.
Your solution is elegant.

When you will open a file and declare a variable count after it, the file will close immediately.
So, Remove the count and put on the top like below.
def count_number_of_lines():
count=0
fhand=open(’/cxldata/datasets/project/mbox-short.txt’):
for line in fhand:

Now you can proceed with your logic.
It should work!

All the best!


#6

def count_number_of_lines():
count = 0
with open(’/cxldata/datasets/project/mbox-short.txt’) as f:

    for line in f:
        line = line.rstrip() # Remove new line characters from right
        if line.startswith('Subject:'):
            count = count + 1
return count    

count_number_of_lines()

got correct answer but after submitting it is saying wrong answer?


#7

Can you take inspiration from Hint?