Why start=2 in enumerate?

OllieGrantOP

Line numbers start at 2 in the rejected messages.

6

Comments 5

Log in to join the discussion.

Log in Create account
  1. AmeliaRunsreplies: 2

    Line 1 is the CSV header, so the first data row is line 2 in the file. Reporting the real file line number lets an operator open the file and jump straight to the bad line.

    2
    1. OllieGrantOPreplies: 1

      Ah, makes sense. Real line numbers for humans.

      2
      1. OliviaPy

        Same, but it felt great to see summary.json saved at the end.

        0
    2. SophieDev

      This is the "boss level" — CSV, validation, dicts, JSON output all in one. Took me two evenings.

      0
      1. JackStack

        Stage 3 tip: build the summary dict first, print it to check, then json.dump() it.

        2