0
    with open("positive-words.txt") as text_file:
        file = text_file.read()

    for line in file:
        if not file.startswith(';') and not file.startswith(' '):
            self.positives.add(file.rstrip("\n"))
    file.close()

And the error I get:

if not .startswith(';') and not file.startswith(' '):
       ^
1

Do you mean to be checking if file starts with? or if the line starts with?

You have if not file.startswith ... so you are not checking the individual line.

2
  • If the line starts with.
    – Cristian
    Jan 14 '17 at 6:19
  • I see. I fixed it now
    – Cristian
    Jan 14 '17 at 6:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .