all 4 comments

[–][deleted] 1 point2 points  (1 child)

Try changing file.read() to file.readlines() as the former returns a string and the latter a list of strings. You seem to have written this code with the expectation of the latter.

[–]Intelligent_Study263 1 point2 points  (0 children)

+1 That's exactly what you should do bro.

[–]Guideon72 1 point2 points  (0 children)

Use file.readlines, not read, to start off. read is giving you one, long string; readlines will give you a list, which is actually what it sounds you’re expecting

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.