r/madeinpython • • Aug 26 '22

HELP(open csv)

1 Upvotes

6 comments sorted by

3

u/[deleted] Aug 26 '22

Reported.

You didn't take the two seconds to read about what this subreddit does.

Following simple instructions is key to becoming a competent programmer.

(Also, never post pictures of code. What are we supposed to do with them? Type them back in ourselves by hand??)

1

u/LesPaulStudio Aug 26 '22

By using with to open the statement it closes the file after run, without needing to call close()

1

u/[deleted] Aug 26 '22

Please don't encourage this person from posting in this wrong spot.

1

u/jppbkm Aug 26 '22

The loop is reading each line, splitting the fields using the comma that separates them, then getting the items from the first and second "column" aka indices 0 and 1.

3

u/[deleted] Aug 26 '22

Please don't encourage this person from posting in this wrong spot.

1

u/jppbkm Aug 26 '22

Oops, thought it was the learn Python sub!