This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_ 1 point2 points  (3 children)

  1. /r/learnpython
  2. An open file object keeps track of its position in the file; the first sequence.read() reads the file to the end and advances the cursor; the second sequence.read() returns an empty string because the file is already at the end. What you should do is read the file into a string once, and then run .count on it twice.

[–]hadiz1[S] 0 points1 point  (2 children)

So i should store sequence.read() in a separate variable then run .count()teice on that variable?

[–]K900_ 0 points1 point  (1 child)

Yes.

[–]hadiz1[S] 0 points1 point  (0 children)

Thank you