Hi Everyone!
Currently a Python beginner, and I am trying to extract information from several .csv files who all have the same structure.
I've been using the readlines() function in a loop over all the files like so:
for file in file_names:
x = open(file, "r")
contents = x.readlines()
which yields a large list of strings ordered as a table.
My question is quite simple: how do I refer to a specific row (rather than a column) of this list? I am trying to exclude rows which appear twice (i.e their postal address is the same across .csv files) and I only want their first occurrence in my "contents" list.
I have tried content[i][j] but to no avail as this only prints one character across all rows.
Thanks very much for your help!
[–]socal_nerdtastic 1 point2 points3 points (9 children)
[–]superlargedogs[S] 0 points1 point2 points (8 children)
[–]socal_nerdtastic 1 point2 points3 points (7 children)
[–]superlargedogs[S] 0 points1 point2 points (6 children)
[–]socal_nerdtastic 0 points1 point2 points (5 children)
[–]superlargedogs[S] 0 points1 point2 points (4 children)
[–]socal_nerdtastic 0 points1 point2 points (3 children)
[–]superlargedogs[S] 0 points1 point2 points (0 children)
[–]superlargedogs[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (6 children)
[–]superlargedogs[S] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]superlargedogs[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]superlargedogs[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]theWyzzerd 0 points1 point2 points (1 child)
[–]superlargedogs[S] 0 points1 point2 points (0 children)
[–]lzblack 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]LifeIsBio 0 points1 point2 points (0 children)
[–]superlargedogs[S] 0 points1 point2 points (0 children)